-2

I have created a VR where I want the users to not change the Stage backwards. However, The system admins can change the opportunity to back stages. Here is my code and it is not working as it should be :-

OR
(AND
(ISCHANGED(StageName),
ISPICKVAL(PRIORVALUE(StageName), "0. Prospecting"),
Intro_Meeting_Accepted__c = FALSE),
(AND
(ISCHANGED(StageName),
ISPICKVAL(PRIORVALUE(StageName), "1. Presentation"),
Sales_Process_Document_Part_A_B__c = FALSE)),
(AND(
ISCHANGED(StageName),
ISPICKVAL(PRIORVALUE(StageName), "2. Scoping"),
Sales_Process_Doc_Part_C__c = FALSE)),
(AND(
ISCHANGED(StageName),
ISPICKVAL(PRIORVALUE(StageName), "3. Proposal"),
SOW_MSA__c = FALSE)),
(AND(
ISCHANGED(StageName),
ISPICKVAL(PRIORVALUE(StageName), "4. Closing"),
PO_has_been_received__c = FALSE))
)&&
NOT(ISPICKVAL(StageName, "Closed Lost"))&&
NOT($Profile.Name <> "System Administrator")
1
  • 1
    Please always include a specific description of the behavior that is not as desired in your posts. We cannot tell just by looking at your metadata. Here, I think you'll probably see the solution if you look carefully at the last line of your Validation Rule. There are lots of existing posts on SFSE about how to exclude users and profiles from Validation Rules; please do search for existing questions as well.
    – David Reed
    Commented Feb 25, 2020 at 14:25

1 Answer 1

1
ISCHANGED(StageName) &&
CASE(StageName,
"Direct Bill Process", 1,
"Awaiting Reservation", 2,
"Reservation Process", 3,
"Awaiting Move In", 4,
"Checked In", 5,
"Checked Out", 6,
"Closed Won", 7,
"Closed Lost", 7,
0)
<
CASE(PRIORVALUE(StageName), 
"Direct Bill Process", 1, 
"Awaiting Reservation", 2, 
"Reservation Process", 3,
"Awaiting Move In", 4,
"Checked In", 5,
"Checked Out", 6,
"Closed Won", 7,
"Closed Lost", 7,
0)
&& $Profile.Name = "System Administrator"

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

3
  • Hey Amber, would you mind editing to include the substantive content of the solution here? We try to avoid having key content behind links.
    – David Reed
    Commented Feb 25, 2020 at 14:20
  • done! thanks and sorry! :-) Commented Feb 25, 2020 at 17:26
  • Thanks @AmberNeillBoaz, I tried doing same earlier as well, but non sys admin users can also change the stage backwards, i logged in as Non-Sys admin user in my sandbox to check that if it works. Here is my VR code :- SCHANGED(StageName) && CASE(StageName, "Prospecting", 0, "Presentation", 1, "Scoping", 2, "Proposal", 3, "Closing", 4, "Closed Won", 5, "Closed Lost", 5, 0) < CASE(PRIORVALUE(StageName), "Prospecting", 0, "Presentation", 1, "Scoping", 2, "Proposal", 3, "Closing", 4, "Closed Won", 5, "Closed Lost", 5, 0) && $Profile.Name = "System Administrator"
    – Rajsxx
    Commented Feb 26, 2020 at 8:21

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