Skip to main content

How to write validation rule for below scenario 

 

Scenario 1 ---> If StageName equals to Closewon and Awarded amount equals to Specification value and opportunity attribute equals to Clos4ed Won Full Spec --->its valid 

 Scenario 2 ---> If StageName equals to Closewon and Awarded amount Less than Specification value and opportunity attribute equals to Closed Won Partial Spec --->its valid

 Scenario 3 ---> If StageName equals to CloseLost and Awarded amount is Zero and opportunity attribute equals to Closed Lost Full Spec  --->its valid

 

otherwise throw validation error

답변 4개
  1. 2023년 7월 12일 오전 9:02

    I would write it like this:

    NOT(

    OR(

    AND(TEXT(StageName)="Closewon",

    OR(

    AND(AwardedAmount__c=SpecificationValue__c, INCLUDES(OpportunityAttributes, "Clos4ed Won Full Spec")),

    AND(AwardedAmount__c<SpecificationValue__c, INCLUDES(OpportunityAttributes, "Closed Won Partial Spec")))),

    AND(TEXT(StageName)="CloseLost",AwardedAmount__c=0, INCLUDES(OpportunityAttributes, "Closed Lost Full Spec"))))

    However, make sure the API names are correct, including the API names for the Stage and Opp Attribute picklist values (you need the API, not the label of picklist values).

    Also, since Opp Attribute is a MS picklist, it coudl have multiple values. This formuls only checks if any of them has the right one selected, regardless of the amount of values. If you want to make sure it's the only value selected, you need to go with:

    NOT(

    AND(PICKLISTCOUNT(OpportunityAttributes)=1,

    OR(

    AND(TEXT(StageName)="Closewon",

    OR(

    AND(AwardedAmount__c=SpecificationValue__c, INCLUDES(OpportunityAttributes, "Clos4ed Won Full Spec")),

    AND(AwardedAmount__c<SpecificationValue__c, INCLUDES(OpportunityAttributes, "Closed Won Partial Spec")))),

    AND(TEXT(StageName)="CloseLost",AwardedAmount__c=0, INCLUDES(OpportunityAttributes, "Closed Lost Full Spec"))))

0/9000