I am just learning the priorvalue formula.
I want a workflow to trigger when the status of my contract changes from On Hold
to Activated
.
I created the following and I am getting syntax error:
AND(
ISCHANGED(Status),
TEXT(PRIORVALUE(Status))="On Hold",
TEXT(Status)=”Activated”
)
Best Answer
It looks like you have some "smart quotes" in there, which will end up throwing some errors. That's unrelated to how to use picklists in formulas though.
In general, when you're working with picklists (such as your standard "Status" field), you need to use
ISPICKVAL()
.TEXT()
can also work, the Use Picklists in Formulas unit on trailhead that Kris points to seems to indicate that bothISPICKVAL(PRIORVALUE(field), value))
andTEXT(PRIORVALUE(field)) = value
would work.The
ISCHANGED()
is also unnecessary here, since you're looking for a specific prior value. That is to say, if Status was "on hold" and now is "activated",ISCHANGED()
would be true. You don't gain anything here by having that check.So, to sum things up:
ISCHANGED()
, it's unnecessaryISPICKVAL(PRIORVALUE(<picklist field>), "target value")
orTEXT(PRIORVALUE(<picklist field>)) = "target value")
should work. Pick one of those two styles, and stick with it. Be consistent throughout your org, and don't mix-and-match