You cannot reference the related Account's fields while writing a validation rule on the Task. The Task object WhatID is polymorphic which means it could be refer to several objects. On the whatid at least you cannot reference related fields like you can with ownerid which is polymorphic as well
The only reliable option will be to make use of an Apex Trigger that prevents the creation of the Task.
There are 2 validation rules.
Under opportunities there is a picklist called STAGE, the standard users (anyone other than Salesforce admin) should not be able to select and save the values in the picklist after the value : "registered"
Ans: You need to mention which particular stageNames standard users will not be allowed to select.
Rule will be like this (put all the stageNames with || condition) and show the error message when following is true:
AND(
ISCHANGED(StageName),
(TEXT(StageName) == 'Registered' || TEXT(StageName) == 'Closed Won'),
$Profile.Name <> 'System Administrator'
)
When new opportunity is being created, in first place only it does not allow to select the value "Registered" in the Stage picklist.
Ans: Show the error message when following is true.
ISNEW() && (TEXT(StageName) == 'Registered')
Standard users cannot update the status of a record that is already Registered (or post-registered phase). For us, some Opp was already “Registered” but some standard user was able to change the record to “Open Won.”
Ans: You need to check PRIORVALUE(field)
in the OR
condition
AND(
$Profile.Name <> "System Administrator",
ISCHANGED(StageName),
OR(
PRIORVALUE(StageName) = "Registered",
TEXT(StageName) = "Registered",
TEXT(StageName) = "Pre-Certified",
TEXT(StageName) = "Documentation, Submission",
TEXT(StageName) = "Performance verified",
TEXT(StageName) = "Appeals",
TEXT(StageName) = "Certification/ Closed Won")
)
Best Answer
If you rename a Validation rule in between deployments, a Changeset will transfer it over as a new Validation rule (!)
Here's the metadata for a Validation Rule
If I deployed the above and then renamed the VR in the UI to
and then deployed again, I get a new rule. There's no label versus API name for a VR.