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
cinziet23cinziet23 

validation rule and criteria are met

Sorry but I am totally new and I'm having major issues to understand it.

 

The workflow rule I would like to setup should first meet the criteria:

 

Opportunity: Sold by Region equals Europe

Opportunity: closed equals False

 

and then should also run if the formula

 

ISCHANGE (Amount) evaluates to true

 

is it possible to set it up all at once?

 

Thanks

Cinzia

Best Answer chosen by Admin (Salesforce Developers) 
@anilbathula@@anilbathula@
Hi Cinzia

yes it possible .
In evaluation criteria:-
created, and every time it’s edited


In work flow rule criteria take formula evaluates true.And apply this formula:-
AND(Sold_by_Region__c='Europe',Isclosed=False,Ischanged(Amount))

If Sold_by_Region__c is a picklist field then use this formula:-
AND(ispickval(Sold_by_Region__c,'Europe'),Isclosed=False,Ischanged(Amount))

Workflow action:-
What ever you want you can do it.






All Answers

@anilbathula@@anilbathula@
Hi Cinzia

yes it possible .
In evaluation criteria:-
created, and every time it’s edited


In work flow rule criteria take formula evaluates true.And apply this formula:-
AND(Sold_by_Region__c='Europe',Isclosed=False,Ischanged(Amount))

If Sold_by_Region__c is a picklist field then use this formula:-
AND(ispickval(Sold_by_Region__c,'Europe'),Isclosed=False,Ischanged(Amount))

Workflow action:-
What ever you want you can do it.






This was selected as the best answer
cinziet23cinziet23

Great! thanks this is so helpful,

 

the sold by region is indeed a picklist field.

 

so I'm going to use

 

AND(ispickval(Sold_by_Region__c,'Europe'),Isclosed=False,Ischanged(Amount))

 

now one step more

what if I would like this rule to evaluate to true not only when the amount chnages but also when the close date or the probability changes.

I am terrible at understanding this syntax...

 

Many thanks

Cin

MellowRenMellowRen

Cin

 

Just embed an OR statement as such:

 

AND(ispickval(Sold_by_Region__c,'Europe'),Isclosed=False,OR(Ischanged(Amount),Ischanged(CloseDate),Ischanged(Probability)))

 

Hope this helps.

 

Regards

MellowRen

cinziet23cinziet23
that's fantastic!

also because I had reached almost the same result by trying to write the formula my self, I have added the fact that the rule is true also when a new opportunity is created:

AND (ispickval(Region_NR__c ,'Europe'),IsClosed=False,(Ischanged(Amount)) ||
(Ischanged( CloseDate )) || (Ischanged( Probability )) || (isnew()))

So for what I understand the rule evaluates to true when...between the opportunities of the European region's that are open, the amount is changed or the close date is change or the probability is changed or it is a new opportunity.

You used an OR at the start and then the coma's, while I used several time the || ...are those to way of writing the formula equivalent? or they might produce 2 different results?

Thank you very much
Cin
MellowRenMellowRen

Cin

 

No, your formula is fine. In Salesforce formulas, the following are equivalent:

 

AND (expression 1, expression 2, ...)       -->       expression 1 && expression 2 && ...
OR  (expression 1, expression 2, ...)       -->       expression 1 || expression 2 || ...

 

So as long as you are careful with the parentheses you can use either. For instance my formula (with the isnew() added) could be:

 

IsPickval(Region_NR__c ,'Europe') && IsClosed=False && (IsChanged(Amount) || IsChanged(CloseDate) || IsChanged(Probability) || IsNew())

 

So which to use? If space is a real concern the &&|| format will produce (very slightly) smaller formulas. Otherwise, write the version that is easiest to read—this helps with both error checking and future editing. For readability, judicious use of returns and spaces as well as mixing the methods (as you have done) becomes your friend. An example:

 

AND ( IsPickval(Region_NR__c ,'Europe'),
      IsClosed=False,
      ( IsChanged(Amount) || IsChanged(CloseDate) || IsChanged(Probability) || IsNew() )
    )

 Good luck.

 

cinziet23cinziet23

Great Thanks,

 

I am starting to enjoy to puzzle around with the formula's and with the tips I get from this forum it's even better.

 

Thanks again

Cin