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
Vinod Kumar TomarVinod Kumar Tomar 

Error while saving WorkFlow with function PRIORVALUE

Hi,

I am  getting below error while saving the workfolow:-

 

Number_of_Applications__c  >  PRIORVALUE( Number_of_Applications__c )

 

Function PRIORVALUE may not be used in this type of formula

 

Can anybody help me on this?

Best Answer chosen by Admin (Salesforce Developers) 
Ritesh AswaneyRitesh Aswaney

That is not entirely true GreatG, the PRIORVALUE function can be used in Workflow rules, but only when the 'Evaluate Rule' criteria is set to 'Every time a record is created or edited'. It wont work for the Create Only and the other one.

 

So change your Evaluate Rule criteria to 'Every time a record is created or edited' and it should let you save - just tried it and saves okay.

All Answers

MiddhaMiddha

PRIORVALUE can only be used in Validation rules and not in workflows. In case you have a rigid requirement of matching a prior value with the current one, try writing a before trigger.

Ritesh AswaneyRitesh Aswaney

That is not entirely true GreatG, the PRIORVALUE function can be used in Workflow rules, but only when the 'Evaluate Rule' criteria is set to 'Every time a record is created or edited'. It wont work for the Create Only and the other one.

 

So change your Evaluate Rule criteria to 'Every time a record is created or edited' and it should let you save - just tried it and saves okay.

This was selected as the best answer
MiddhaMiddha

Agreed, thanks for correcting me.

Vinod Kumar TomarVinod Kumar Tomar

Thanks a lot to both of you for helping me on the issue.