0

I need to make a validation rule for Opportunities to make sure AEs can't edit closed won opportunity stages. The syntax for the rule I made works but when I log in as an AE I can change the opportunity stage without getting an error message.

AND(
    CONTAINS($UserRole.Name, 'Account.Executives') ,
    ISCHANGED(StageName) ,
    ISPICKVAL(PRIORVALUE(StageName),'Closed Won')
)

What am I missing?

4
  • 2
    I'd expect the issue to be you looking for 'Account.Executives' in the Id of your user role rather than the name of your user role.
    – Derek F
    Feb 3, 2022 at 22:57
  • Ok I changed that to $UserRole.Name and tried both these versions of the rule: 1) CONTAINS( $UserRole.Name, 'Account.Executives') && ISCHANGED(StageName) && TEXT(PriorValue(StageName))= "Closed Won"
    – Sonali
    Feb 3, 2022 at 23:22
  • 2) CONTAINS( $UserRole.Name, 'Account.Executives') && ISCHANGED(StageName) && ISPICKVAL(PRIORVALUE(StageName),'Closed Won')
    – Sonali
    Feb 3, 2022 at 23:24
  • please use edit to amend your post with latest VR; avoid comment
    – cropredy
    Feb 4, 2022 at 0:05

1 Answer 1

0

In contains you have to put a string with the name of the userRole, like "Executive Staff".

AND(
    CONTAINS($UserRole.Name, 'Executive Staff') ,
    ISCHANGED(StageName) ,
    ISPICKVAL(PRIORVALUE(StageName),'Closed Won')
)

You must log in to answer this question.

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