0

I'd like to prevent users from "skipping" Opportunity Stages, For example, I do not want a user to advance to Stage 6 without having been in Stage 1,2,3,4,5. After Staging 6 they will go any stage they want,

AND( ISCHANGED(ASN_Status__c), CASE( ASN_Status__c , "Draft", 1, "Submitted", 2, "Active", 3, "Material Received", 4, "Inspection", 5, "Staging",6, 1) <> CASE(PRIORVALUE(ASN_Status__c), "Draft", 1, "Submitted", 2, "Active", 3, "Material Received", 4, "Inspection", 5, "Staging",6, 0 ) +1 )

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – bpilling
    Nov 17 at 8:18

1 Answer 1

0

Try with below validation rule on opportunity object. Replace the picklist values Stage1,Stage2,Stage3,Stage4,Stage5,Stage6 with your correct values in your org.

AND(
ISCHANGED(StageName),
OR(AND(ISPICKVAL(PRIORVALUE(StageName),""),
       OR(ISPICKVAL(StageName,"Stage2"),
          ISPICKVAL(StageName,"Stage3"),
          ISPICKVAL(StageName,"Stage4"),
          ISPICKVAL(StageName,"Stage5"),
          ISPICKVAL(StageName,"Stage6"))),
    AND(ISPICKVAL(PRIORVALUE(StageName),"Stage1"),NOT(ISPICKVAL(StageName,"Stage2"))
    ),
    AND(ISPICKVAL(PRIORVALUE(StageName),"Stage2"),NOT(ISPICKVAL(StageName,"Stage3"))
    ),
    AND(ISPICKVAL(PRIORVALUE(StageName),"Stage3"),NOT(ISPICKVAL(StageName,"Stage4"))
    ),
    AND(ISPICKVAL(PRIORVALUE(StageName),"Stage4"),NOT(ISPICKVAL(StageName,"Stage5"))
    ),
    AND(ISPICKVAL(PRIORVALUE(StageName),"Stage5"),NOT(ISPICKVAL(StageName,"Stage6"))
    )
    )
)

PRIORVALUE:

Returns the previous value of a field.

Use: PRIORVALUE(field)

AND:

Returns a TRUE response if all values are true; returns a FALSE response if one or > more values are false.

Use the && (AND) function as an alternative to the operator.

Use:

AND(logical1,logical2,...) and replace logical1,logical2,... with the values >that you want evaluated.

OR:

Determines if expressions are true or false. Returns TRUE if any expression is >true. Returns FALSE if all expressions are false.

Use this function as an alternative to the operator || (OR)

Use:

OR(logical1, logical2...) and replace any number of logical references with the >expressions you want evaluated.

IF:

Determines if expressions are true or false. Returns a given value if true and >another value if false.

Use: IF(logical_test, value_if_true, value_if_false) and replace logical_test with the >expression you want evaluated; replace value_if_true with the value you want >returned if the expression is true; replace value_if_false with the value you want >returned if the expression is false.

Refer the All Formula Operators and Functions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.