Skip to content

Instantly share code, notes, and snippets.

@sday222
Last active August 8, 2025 20:09
Show Gist options
  • Save sday222/5745c6c5611d417f30cc15ee16c93d29 to your computer and use it in GitHub Desktop.
Save sday222/5745c6c5611d417f30cc15ee16c93d29 to your computer and use it in GitHub Desktop.
Salesforce Validation Rules
AND(
NOT(ISNEW()),
RecordTypeId = '0124P0000015aTAQAY',
ISCHANGED(StageName),
(
CASE(
StageName,
"Stage 0", 0,
"Stage 1", 1,
"Stage 2", 2,
"Stage 3", 3,
"Stage 4", 4,
"Stage 5", 5,
"Stage 6", 6,
"Stage 7", 7,
0
) -
CASE(
PRIORVALUE(StageName),
"Stage 0", 0,
"Stage 1", 1,
"Stage 2", 2,
"Stage 3", 3,
"Stage 4", 4,
"Stage 5", 5,
"Stage 6", 6,
"Stage 7", 7,
0
)
) > 1
)
AND(
IsClosed = TRUE,
CloseDate < TODAY()
)
AND(
ISCHANGED(Territory__c),
ISPICKVAL(Territory__c, "Protected"),
OR(
$Profile.Name <> "System Administrator",
TEXT($User.Sales_Authority_Level__c) = "High"
)
)
AND(
ISCHANGED(Dead_Reason__c),
IF(TEXT(Dead_Reason__c) = "Marketo Hard or Repeat Soft Bounce", TRUE, FALSE),
$User.Alias != "marketo"
)
AND(
ISBLANK(Business_Development_Rep__c),
ISCHANGED(Business_Development_Rep__c),
$UserRole.Name = "BDR"
)
AND(
TEXT(Type) = "New Business",
ISCHANGED(StageName),
CASE(
StageName,
"Stage 0", 0,
"Stage 1", 1,
"Stage 2", 2,
"Stage 3", 3,
"Stage 4", 4,
"Stage 5", 5,
"Stage 6", 6,
"Stage 7", 7,
0
) > 0,
ISBLANK(Item_to_Ensure_is_Populated__c),
)
AND(
ISCHANGED(OwnerId),
$UserRole.Name = "BDR"
)
AND(
CloseDate < TODAY(),
ISPICKVAL(StageName, "Closed Won"),
NOT(
OR(
$Profile.Id = "00e4P0000015aTAQAY",
$Profile.Id = "00e4P0000015aTAQAY"
)
)
)
AND(
ISCHANGED(OwnerId),
Owner.UserRoel.Name = "CSM"
)
This is a collection of my favorite Salesfoce Validation rules. You can read more about these on my Substack:
https://revopstoolkit.substack.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment