function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alexander G GoodmanAlexander G Goodman 

Reverse a formula to uncheck something

Long story short: I have made a workflow that updates a check box to true when certian  critia are met, I now want to make the opersite of it so that when the critia no longer matchs what I need it it then updates it to false (its importaint as I have a validation rule riding on this working).
This is the formula minus sensative info which is covered by asterisks: 
AND( OR( ISNEW(), ISNULL( ***_****__c), ISNULL( ****_****__c ) ), ISPICKVAL( Product2.Family, '****'), OR(Opportunity.Probability < 90, Opportunity.IsClosed = FALSE))
any ideas
Varun PareekVarun Pareek
Add another workflow rule and field update.
Workflow rule criteria would EXACTLY be the opposite:
NOT(AND( OR( ISNEW(), ISNULL( ***_****__c), ISNULL( ****_****__c ) ), ISPICKVAL( Product2.Family, '****'), OR(Opportunity.Probability < 90, Opportunity.IsClosed = FALSE)))

Notice the NOT operator which "reverses" the formula.

Once this WF rule is written, add a field update to mark the field value per your requirement.

NOTE: Validation rule runs before a workflow update and if your validation depends on your WF rule, then you would have to handle it in a different manner. Refer the order of execution here:
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm
Alexander G GoodmanAlexander G Goodman
Thanks for this and yes the Validation rule depends on Workflow so do you have any suggestions on getting around this problem?
Varun PareekVarun Pareek
You may have to go with a "Before" trigger.