Validation rule not working, potentially due to interaction with record locking from approval flow? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Wensheen TongWensheen Tong 

Validation rule not working, potentially due to interaction with record locking from approval flow?

Hi all,

Solo admin here - frequent reader, but first time posting! I have a validation rule with only a few conditions that isn't firing for some reason. I've gone through it line by line and can't figure out why it isn't working; our SFDC Solutions Engineer is also stumped, so I'm hoping this group can help us out.

Some context:
  • We built a tiered approval process that requires manager approval at a certain discount threshold, Director at a threshold above that, and then VP approval at a threshold above that.
    • The approval process seems to be working properly in that the record is locking and the right email alerts are triggering at each step. 
    • I also built Process Builders to auto-send all eligible records through the flow once they hit Proposal stage (50% probability) to balance giving the reps flexibility in the earlier stages of the deal against ensuring any pricing that's being shared with the customer has been approved
  • However, some opps are jumping straight from an early stage (i.e. Validation) to Order Submitted / 95% (our reps' last stage before Closed Won). 
    • The approval flow is working properly in that the record is locking and the email alerts are sending, but moving to 95% also triggers a deal alert out to the entire sales org, and we're worried that reps are prematurely celebrating deals that haven't actually been approved yet
  • To prevent this, I wrote an additional validation rule next week to throw an error if a rep was trying to move an opp beyond 90%
    • The logic isn't that complex, but multiple opps have slipped through and still made it to 95% despite the rule being active and having no syntax errors
    • The rule is here: https://na59.salesforce.com/03df4000000fSsL?setupid=OpportunityValidations
I'm wondering if the record locking is somehow preventing the rule from firing, but haven't been able to find any documentation around this.

Any ideas?

Thanks!
Best Answer chosen by Wensheen Tong
Steve MolisSteve Molis
Ah!!!  

Probbability% is a decimal value, not a whole number 

90 = 9000% 

use 0.45 and 0.90
 
AND ( 
ISPICKVAL(Type, "End Customer") , Amount > 0, 
Overall_Discount__c > 0.45 , 
OR ( 
Probability > 0.90 ,
ISPICKVAL( StageName, "Order" ) ,
ISPICKVAL( StageName, "Order Submitted" ) 
) , 
OR( 
ISPICKVAL(VP_Pricing_Approval__c , "Not Approved"),
ISPICKVAL(VP_Pricing_Approval__c , "Submitted"),
ISBLANK(TEXT(VP_Pricing_Approval__c)) 
) 
)

 

All Answers

Steve MolisSteve Molis
Can you post your Validation Rule Formulas as well as screenshots of an Opportunity that "jumped the rule" showing the complete Approval and Stage History?
Wensheen TongWensheen Tong

Sure thing!
 

here's the validation rule code:

AND ( 
ISPICKVAL(Type, "End Customer") 
, Amount > 0 
, Overall_Discount__c > 45 
, OR ( 
Probability > 90 
,ISPICKVAL( StageName, "Order" ) 
,ISPICKVAL( StageName, "Order Submitted" ) 

, OR( 
ISPICKVAL(VP_Pricing_Approval__c , "Not Approved") 
,ISPICKVAL(VP_Pricing_Approval__c , "Submitted") 
,ISBLANK(TEXT(VP_Pricing_Approval__c)) 

)


Here's an example opp that "jumped" the rule: https://na59.salesforce.com/006f400000KV3F5 

  • Opportunity: Salvation Army - Seattle 2
  • Total MSRP: $32,854.00
  • Requested Discount: 50%


Stage history (Lillian is the rep, and then Meera is our Ops Manager who processed the opp:
User-added image

CW = shipped in our org, so "Order Submitted" is the last stage that the rep touches.

  • When Lillian moved this opp ot Order Submitted, the record locked and the alert for manager approval went out, but the deal alert ALSO went out to the whole org at the same time (12:29 PM)
  • Director and VP approval didn't come through until after: 
User-added image
Garrison is Lillian's manager; Ryan B is the Director, and Brandon is our VP.

Thanks!
Steve MolisSteve Molis
Ah!!!  

Probbability% is a decimal value, not a whole number 

90 = 9000% 

use 0.45 and 0.90
 
AND ( 
ISPICKVAL(Type, "End Customer") , Amount > 0, 
Overall_Discount__c > 0.45 , 
OR ( 
Probability > 0.90 ,
ISPICKVAL( StageName, "Order" ) ,
ISPICKVAL( StageName, "Order Submitted" ) 
) , 
OR( 
ISPICKVAL(VP_Pricing_Approval__c , "Not Approved"),
ISPICKVAL(VP_Pricing_Approval__c , "Submitted"),
ISBLANK(TEXT(VP_Pricing_Approval__c)) 
) 
)

 
This was selected as the best answer
Wensheen TongWensheen Tong
ahh that'll do it. Thank you!!