Skip to main content
Hi All,

 

I'm trying to write a validation rule and can't get it to work properly. The rule should prompt the user to insert a maintenance program if the maintenance program flag is false, the description on the quote doesn't contain the text "Created By Maintenance Only Opp", and the quote status is "PO Received". This rule is excluding our integration profiles.

 

Here is the rule:

 

AND( 

 

NOT(CONTAINS( Description__c ,"Created By Maintenance Only Opp")) 

 

,Maintenance_Program__c = FALSE 

 

, ISPICKVAL(Quote_Status__c, "PO Received") 

 

, $Profile.Name != 'Integration Administration' 

 

, $Profile.Name != 'API User' 

 

)

 

The test case I'm running has the maintenance program as false, the description is null, and I'm updating the quote status to "PO Received" as a user without the integration admin, api user profile. Based on the validation criteria I would have expected this rule to fire.

 

I have validated this rule is active and written against the object I am testing with.

 

Any thoughts?
8 risposte
  1. 16 ago 2019, 16:27

    Try something like this

    AND(

    CASE($Profile.Name ,

    'Integration Administration',1,

    'API User',1,

    0 ) = 0,

    Maintenance_Program__c = FALSE,

    TEXT(Quote_Status__c) = "PO Received",

    OR(

    NOT(CONTAINS( Description__c ,"Created By Maintenance Only Opp")),

    ISBLANK(Description__c)

    )

    )

     

     
0/9000