You need to sign in to do that
Don't have an account?
Glenn Soden 2
Granular Opp Stage Validation Rule by Profile rule
I know there are many Validation rule solutions out there but not finding one for my use case. We currently allow certain profiles ability to change Opportunity Stage using all encompassing "AND( ISCHANGED( StageName ),
$Profile.Name <> "System Administrator) - and adding any other profiles, user id's etc we want to by pass this rule. This works fine.
New requirment is to keep this but add a profile that can change ONLY certain picklist values on the Opportunity stage. That is where I am stuck. Was thinking I could add that profile to this rule, then create a new rule specifically for the profile that will have partial ability to change stage. But the original rule overrides the lower limiting rule for the profile.
How can I acheive limiting picklist values for one profile (ie keeping what we have but prevnting this new profile from changing to close won, closed lost, etc) while keeping the current rule bypass in place for the other profiles? Any help would be appreciated
$Profile.Name <> "System Administrator) - and adding any other profiles, user id's etc we want to by pass this rule. This works fine.
New requirment is to keep this but add a profile that can change ONLY certain picklist values on the Opportunity stage. That is where I am stuck. Was thinking I could add that profile to this rule, then create a new rule specifically for the profile that will have partial ability to change stage. But the original rule overrides the lower limiting rule for the profile.
How can I acheive limiting picklist values for one profile (ie keeping what we have but prevnting this new profile from changing to close won, closed lost, etc) while keeping the current rule bypass in place for the other profiles? Any help would be appreciated
Here's the first one, which is very similar to what you had originally -- we're just telling also Salesforce to allow the EE Res Sales profile's to make whatever changes it wants to Stage. (I know that in itself isn't sufficient for what you want, but hang with me):
Name: Block_Restricted_Profiles_from_All_Stages
Description: Throw an error when anyone except full-access profiles or the EE Res Sales profile tries to change the Opp Stage.
Formula:
AND(
ISCHANGED(StageName),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile1",
$Profile.Name <> "Profile2",
$Profile.Name <> "EE Res Sales"
)
Now, with the second one, we'll restrict which Stage values the EE Res Sales profile can use. The individual stages you list within this one should be the Stages that EE Res Sales are allowed to use.
Name: Enforce_Stages_for_EE_Res_Sales
Description: Throw an error when EE Res Sales profile tries to change the Opp Stage to something other than their allowed Stage values. (This will ignore when full-access profiles change the Stage.)
Formula:
AND(
$Profile.Name = "EE Res Sales",
ISCHANGED(StageName),
OR(
NOT(ISPICKVAL(StageName, "Received")),
NOT(ISPICKVAL(StageName, "Signed Contract Received"))
),
)
All Answers
Try something like this (writing over all my dummy values inside quotation marks):
Hmm. Are you willing to copy/paste your validation rule so I can take a look? Feel free to take out any values inside the " "s if they're sensitive, but leave everything else intact.
I'm still thinking it's gotta be just a comma or parenthesis out of place somewhere, but unfortunately I can't pinpoint where without looking at what you've got.
AND( ISCHANGED( StageName ),
$Profile.Name <> "System Administrator",$Profile.Name <> "Profile1", $Profile.Name <> "Profile2"),
AND(
ISPICKVAL(StageName, "Received"),
ISPICKVAL(StageName, "Signed Contract Received"),
$Profile.Name <> "EE Res Sales "
)
)
Ah, gotcha -- you just forgot the "or" at the top. =) Actually, I'm glad you did because I caught a couple mistakes on my part. Here's what it should be:
OR(
AND(
ISCHANGED(StageName),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile1",
$Profile.Name <> "Profile2"
),
AND(
$Profile.Name = "EE Res Sales ",
OR(
NOT(ISPICKVAL(StageName, "Received")),
NOT(ISPICKVAL(StageName, "Signed Contract Received"))
)
)
)
That probably looks confusing, but basically you're just telling Salesforce to throw an error if either one of these statements are true:
1) Throw an error if the Stage changes and the user logged in doesn't have one of those specified/allowed profiles, or
2) Throw an error if the user logged in has the EE Res Sales profile and the Stage isn't one of those specified/allowed Stage values
Sorry about that. Hopefully that version will save for you, then test out your scenarios and let me know if I made any other mistakes. =)
ie:
OR(
AND(
ISCHANGED(StageName),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile1",
$Profile.Name <> "Profile2"
),
AND(
$Profile.Name = "Profile1 ",
OR(
NOT(ISPICKVAL(StageName, "Received")), <-------prevents this entry
NOT(ISPICKVAL(StageName, "Signed Contract Received")) <---- allows this entry
)
)
)
Here's the first one, which is very similar to what you had originally -- we're just telling also Salesforce to allow the EE Res Sales profile's to make whatever changes it wants to Stage. (I know that in itself isn't sufficient for what you want, but hang with me):
Name: Block_Restricted_Profiles_from_All_Stages
Description: Throw an error when anyone except full-access profiles or the EE Res Sales profile tries to change the Opp Stage.
Formula:
AND(
ISCHANGED(StageName),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile1",
$Profile.Name <> "Profile2",
$Profile.Name <> "EE Res Sales"
)
Now, with the second one, we'll restrict which Stage values the EE Res Sales profile can use. The individual stages you list within this one should be the Stages that EE Res Sales are allowed to use.
Name: Enforce_Stages_for_EE_Res_Sales
Description: Throw an error when EE Res Sales profile tries to change the Opp Stage to something other than their allowed Stage values. (This will ignore when full-access profiles change the Stage.)
Formula:
AND(
$Profile.Name = "EE Res Sales",
ISCHANGED(StageName),
OR(
NOT(ISPICKVAL(StageName, "Received")),
NOT(ISPICKVAL(StageName, "Signed Contract Received"))
),
)