2

I have a picklist Advancement which has values Stage 1, Stage 2 and Stage 3. I want users (except for System Admins) NOT to be able to go from Stage 1 to Stage 3.

I have written the following validation rule:

AND( PRIORVALUE( ISPICKVAL ( Advancement, "Stage 1") ),  ISPICKVAL(Advancement, "Stage 3")  )

The validation rule does not work, as the syntax is incorrect. However, I cannot think how I can express that I want to disallow a certain value if another was selected previously. Tia, Lily

3 Answers 3

6

Try this:

AND( ISPICKVAL( PRIORVALUE ( Advancement__c), "Stage 1"), ISPICKVAL(Advancement__c, "Stage 3"), NOT ($Profile.Name = "System Administrator") )

3

From Formula Operators and Functions(PriorValue)

When using the ISPICKVAL function to return the previous value of a picklist field, include the PRIORVALUE function inside the ISPICKVAL function as in this example:

ISPICKVAL(PRIORVALUE (picklist_field), text_literal)

So change your formula to

AND( ISPICKVAL( PRIORVALUE ( Advancement), "Stage 1" ),  ISPICKVAL(Advancement, "Stage 3") )

Hope it helps.

3
  • But it throws error for system admin right @Vigneshwaran G
    – Pavan tej
    May 9, 2016 at 19:39
  • Yes. If you want to exclude System Admin, try using the way Oleksiy had suggested. My intention in this answer was to provide how exactly to use PRIORVALUE with ISPICKVAL. May 9, 2016 at 19:45
  • @VigneshwaranG, PRIORVALUE is using field as an argument: PRIORVALUE ( Advancement )
    – o-lexi
    May 9, 2016 at 20:27
1

All credit for this approach goes to Steve Molis, and you can see the orig post here

https://success.salesforce.com/answers?id=90630000000goLJAAY

Using the case function and some simple math can make this type of rule very simple. See this example below which you can tweak per your specific needs.

CASE( StageName ,  "Prospecting",1,  "Qualification",2,  "Needs Analysis",3,  "Value Proposition",4,  "Id. Decision Makers",5,  "Perception Analysis",6,  "Proposal/Price Quote",7,  "Negotiation/Review",8,  "Closed Won",9,  "Closed Lost",9,0)  <  CASE(PRIORVALUE(StageName) ,  "Prospecting",1,  "Qualification",2,  "Needs Analysis",3,  "Value Proposition",4,  "Id. Decision Makers",5,  "Perception Analysis",6,  "Proposal/Price Quote",7,  "Negotiation/Review",8,  "Closed Won",9,  "Closed Lost",9,0)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .