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
Ti Saunders 8Ti Saunders 8 

Workflow Rule Formula -Prior Value - Value for Picklist

We have a field called Lead_Rating which is a picklist with options: A+, A, B, C, or D. I am trying to write a workflow rule that will trigger when the Lead_Rating field is changed FROM D or C, to A+, A, or B.

In addition to the above, the rule should only trigger if another field called "Lead_Status" (also a picklist) is equal to one of these 3 values: New, Returning, or Qualified. 

I'm trying the below formula, but am getting: 
Error: Function PRIORVALUE may not be used in this type of formula

AND( 
OR(text(PRIORVALUE( Lead_Status__c )='D'), text(PRIORVALUE(Lead_Status__c )='C')) 
,OR(Lead_Status__c='A', Lead_Status__c='A+', Lead_Status__c='B'))
Dhanya NDhanya N
Hi Saunders,

You might have used evaluation criteria as "created, and any time it's edited to subsequently meet criteria". 
Change it to "created, and every time it's edited" (2nd option). 

Thanks,
Dhanya
Ti Saunders 8Ti Saunders 8
I've changed the criteria and am getting more errors.

My new formula is:

AND( 
OR(text(PRIORVALUE(Lead_Rating__c),'D'), text(PRIORVALUE(Lead_Rating__c),'C')) 
,OR(Lead_Rating__c='A+', Lead_Rating__c='A', Lead_Rating__c='B'), 
Lead_Status__c = New, Returning, Pursuing, 'Sales Qualified' 
)

One of the errors is: Error: Incorrect number of parameters for function 'text()'. Expected 1, received 2
Dhanya NDhanya N
The formula you are using is wrong in syntax. Follow Picklist Formulas (https://trailhead.salesforce.com/en/content/learn/modules/advanced_formulas/picklist_formulas) for more details.

Give a try with below formula:
AND( 
OR(ISPICKVAL(PRIORVALUE(Lead_Rating__c),"D"), ISPICKVAL(PRIORVALUE(Lead_Rating__c),"C")) 
, OR(ISPICKVAL(Lead_Rating__c, "A+"), ISPICKVAL(Lead_Rating__c, "A"), ISPICKVAL(Lead_Rating__c, "B")), 
OR(ISPICKVAL(Lead_Status__c, "New"), ISPICKVAL(Lead_Status__c, "Returning"), 
ISPICKVAL(Lead_Status__c, "Qualified")) 
)