function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phillip Moseley 2Phillip Moseley 2 

How to exclude specific record type from opportunity validation rule?

Hello, I have the following opportunity validation rule that exists today and works great, but I need it to exclude a recent record type that we created. So I need the formula below to work except when the opportunity record type is eSupply.

Current Formula Below would need to now have Exclude Record Type eSupply:

IF($User.ProfileId= "2F00e6A000001Zmda", False,

AND( 
OR(
ISPICKVAL(StageName, "Closed/Won"),
ISPICKVAL(StageName, "Submitted")),
ISPICKVAL(Type, "Renewal"),
ISBLANK(Prior_Term_in_Months__c) 
))

I appreciate the help in advance.

Phillip
Best Answer chosen by Phillip Moseley 2
AnkaiahAnkaiah (Salesforce Developers) 
Hi Phillip,

try with below formula. replace profile name with your profile name instead of profile Id.
IF( $Profile.Name = "System Administrator", False,

AND( 
OR(
ISPICKVAL(StageName, "Closed/Won"),
ISPICKVAL(StageName, "Submitted")),
ISPICKVAL(Type, "Renewal"),
ISBLANK(Prior_Term_in_Months__c),
RecordType.Name <> "eSupply"
))

If this helps, Please mark it as best answer.

Thanks!!

All Answers

Maharajan CMaharajan C
Hi Phillip,

Please try the below validation rule:
 
IF(OR($User.ProfileId= "2F00e6A000001Zmda",RecordType.Name = "eSupply"), 
False,
AND( 
OR(
ISPICKVAL(StageName, "Closed/Won"),
ISPICKVAL(StageName, "Submitted")),
ISPICKVAL(Type, "Renewal"),
ISBLANK(Prior_Term_in_Months__c) 
)
)

Thanks,
Maharajan.C
AnkaiahAnkaiah (Salesforce Developers) 
Hi Phillip,

try with below formula. replace profile name with your profile name instead of profile Id.
IF( $Profile.Name = "System Administrator", False,

AND( 
OR(
ISPICKVAL(StageName, "Closed/Won"),
ISPICKVAL(StageName, "Submitted")),
ISPICKVAL(Type, "Renewal"),
ISBLANK(Prior_Term_in_Months__c),
RecordType.Name <> "eSupply"
))

If this helps, Please mark it as best answer.

Thanks!!
This was selected as the best answer