Applying 2 x record types to one validation script - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Bob BellBob Bell 

Applying 2 x record types to one validation script

Hi Guys

I have the following validation script that activates when the following is true. I however need to add another record type called "Transactional_Opportunity_NSC4I" to this script, how would I include it?



AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" ),

OR(

(Stage_2_Approved__c = FALSE),
ISPICKVAL(Division__c, ""),
ISPICKVAL(Thales_Division__c, ""),
ISPICKVAL(Strategic_Business_Line_SBL__c, ""),
ISPICKVAL(Business_Unit__c, ""),

ISBLANK( Account.Name),
ISPICKVAL(Customer_Program_Name__c, ""),
ISPICKVAL(Customer_Program_Phase__c, ""),
ISBLANK(Name),
ISPICKVAL(Country__c,""),
ISBLANK(End_User_b__c),
ISPICKVAL(Site__c , ""),
ISPICKVAL(Legal_Entity_Prime_Contractor__c,""),
ISPICKVAL(Country_of_Legal_Entity__c,""),
ISPICKVAL(Ex_group_Intra_group__c, ""),
ISPICKVAL(Domestic_Import_Export__c, ""),
ISPICKVAL(MIL_CIV__c, ""),
ISBLANK(RFP_Issue_Date__c),
ISBLANK(Proposal_Due_Date__c),
ISBLANK(CloseDate),
ISPICKVAL(Prospect_Type__c,""),
ISPICKVAL(Category__c,""),

ISBLANK(Contract_Duration_Mths__c),

ISBLANK(P1__c),
ISBLANK(P2__c),

ISBLANK(Amount),

ISPICKVAL(Currency__c,""),

ISPICKVAL(Bid_Category__c, ""),

ISPICKVAL(Capture_Lead__c, ""),
ISPICKVAL(Sales_Lead__c, ""),
ISPICKVAL(Sales_Manager_Country__c, ""),
ISPICKVAL(Sales_manager_Unit__c, "")

))
Ryley HayesRyley Hayes
 I would add another OR function to the beginning, like this:

AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),
OR(
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" ),
($RecordType.DeveloperName  = "Transactional_Opportunity_NSC4I"))

That should make the first part of your AND function evaluate to true if either Record Type is selected.

Bob BellBob Bell
Hi

I am trying this, howver the error message still appears when I use a different record type name, any ideas?

bob




AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),

OR(

($RecordType.DeveloperName  = "Transactional_Opportunity_NSC4I" ),
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" ),


(Stage_2_Approved__c = FALSE),
ISPICKVAL(Division__c, ""),
ISPICKVAL(Thales_Division__c, ""),
ISPICKVAL(Strategic_Business_Line_SBL__c, ""),
ISPICKVAL(Business_Unit__c, ""),

ISBLANK( Account.Name),
ISPICKVAL(Customer_Program_Name__c, ""),
ISPICKVAL(Customer_Program_Phase__c, ""),
ISBLANK(Name),
ISPICKVAL(Country__c,""),
ISBLANK(End_User_b__c),
ISPICKVAL(Site__c , ""),
ISPICKVAL(Legal_Entity_Prime_Contractor__c,""),
ISPICKVAL(Country_of_Legal_Entity__c,""),
ISPICKVAL(Ex_group_Intra_group__c, ""),
ISPICKVAL(Domestic_Import_Export__c, ""),
ISPICKVAL(MIL_CIV__c, ""),
ISBLANK(RFP_Issue_Date__c),
ISBLANK(Proposal_Due_Date__c),
ISBLANK(CloseDate),
ISPICKVAL(Prospect_Type__c,""),
ISPICKVAL(Category__c,""),

ISBLANK(Contract_Duration_Mths__c),

ISBLANK(P1__c),
ISBLANK(P2__c),

ISBLANK(Amount),

ISPICKVAL(Currency__c,""),

ISPICKVAL(Bid_Category__c, ""),

ISPICKVAL(Capture_Lead__c, ""),
ISPICKVAL(Sales_Lead__c, ""),
ISPICKVAL(Sales_Manager_Country__c, ""),
ISPICKVAL(Sales_manager_Unit__c, "")

))
Bob BellBob Bell
Hi

I am trying this, howver the error message still appears when I use a different record type name, any ideas?

bob




AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),

OR(

($RecordType.DeveloperName  = "Transactional_Opportunity_NSC4I" ),
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" ),


(Stage_2_Approved__c = FALSE),
ISPICKVAL(Division__c, ""),
ISPICKVAL(Thales_Division__c, ""),
ISPICKVAL(Strategic_Business_Line_SBL__c, ""),
ISPICKVAL(Business_Unit__c, ""),

ISBLANK( Account.Name),
ISPICKVAL(Customer_Program_Name__c, ""),
ISPICKVAL(Customer_Program_Phase__c, ""),
ISBLANK(Name),
ISPICKVAL(Country__c,""),
ISBLANK(End_User_b__c),
ISPICKVAL(Site__c , ""),
ISPICKVAL(Legal_Entity_Prime_Contractor__c,""),
ISPICKVAL(Country_of_Legal_Entity__c,""),
ISPICKVAL(Ex_group_Intra_group__c, ""),
ISPICKVAL(Domestic_Import_Export__c, ""),
ISPICKVAL(MIL_CIV__c, ""),
ISBLANK(RFP_Issue_Date__c),
ISBLANK(Proposal_Due_Date__c),
ISBLANK(CloseDate),
ISPICKVAL(Prospect_Type__c,""),
ISPICKVAL(Category__c,""),

ISBLANK(Contract_Duration_Mths__c),

ISBLANK(P1__c),
ISBLANK(P2__c),

ISBLANK(Amount),

ISPICKVAL(Currency__c,""),

ISPICKVAL(Bid_Category__c, ""),

ISPICKVAL(Capture_Lead__c, ""),
ISPICKVAL(Sales_Lead__c, ""),
ISPICKVAL(Sales_Manager_Country__c, ""),
ISPICKVAL(Sales_manager_Unit__c, "")

))
Ryley HayesRyley Hayes
 If that's a direct copy and paste of what your using, make sure to add one more close-parentheses to close out that first or function:
OR(
($RecordType.DeveloperName  = "Transactional_Opportunity_NSC4I" ),
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" )
)

What you have right now will cause it to fire when anything below that first or is true. 
Bob BellBob Bell
Hi, this still doesn't work. Its not not applying any of the validation on the fields....
Ryley HayesRyley Hayes
 Can you copy and paste exactly what you have in here?
Bob BellBob Bell
Hi, this still doesn't work. Its not not applying any of the validation on the fields....
Ryley HayesRyley Hayes
 Think I see the problem. try this:

AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),

OR(

($RecordType.DeveloperName  = "Transactional_Opportunity_NSC4I" ),
($RecordType.DeveloperName  = "New_Contract_Opportunity_NSC4I" )),

OR(
(Stage_2_Approved__c = FALSE), 
ISPICKVAL(Division__c, ""),
ISPICKVAL(Thales_Division__c, ""),
ISPICKVAL(Strategic_Business_Line_SBL__c, ""),
ISPICKVAL(Business_Unit__c, ""),

ISBLANK( Account.Name),
ISPICKVAL(Customer_Program_Name__c, ""),
ISPICKVAL(Customer_Program_Phase__c, ""),
ISBLANK(Name),
ISPICKVAL(Country__c,""),
ISBLANK(End_User_b__c),
ISPICKVAL(Site__c , ""),
ISPICKVAL(Legal_Entity_Prime_Contractor__c,""),
ISPICKVAL(Country_of_Legal_Entity__c,""),
ISPICKVAL(Ex_group_Intra_group__c, ""),
ISPICKVAL(Domestic_Import_Export__c, ""),
ISPICKVAL(MIL_CIV__c, ""),
ISBLANK(RFP_Issue_Date__c),
ISBLANK(Proposal_Due_Date__c),
ISBLANK(CloseDate),
ISPICKVAL(Prospect_Type__c,""),
ISPICKVAL(Category__c,""),

ISBLANK(Contract_Duration_Mths__c),

ISBLANK(P1__c),
ISBLANK(P2__c),

ISBLANK(Amount),

ISPICKVAL(Currency__c,""),

ISPICKVAL(Bid_Category__c, ""),

ISPICKVAL(Capture_Lead__c, ""),
ISPICKVAL(Sales_Lead__c, ""),
ISPICKVAL(Sales_Manager_Country__c, ""),
ISPICKVAL(Sales_manager_Unit__c, "")
))

There needs to be two OR statements. One to look at the record types, and other that looks at all those fields. 
 
Bob BellBob Bell
That was the right idea Ryley. I finally achieved it with the following. Thanks for your help!

AND (

ISPICKVAL(StageName, "2 - Capture (Pre Gate 1 - Go)"),
(OR (($RecordType.Name = "New Contract Opportunity - NSC4I" ),
($RecordType.Name = "Transactional Opportunity - NSC4I" ),
($RecordType.Name = "New Contract Opportunity Naval" ))),
(OR(
(!Stage_2_Approved__c),
ISPICKVAL(Division__c, ""),
ISPICKVAL(Thales_Division__c, ""),
ISPICKVAL(Strategic_Business_Line_SBL__c, ""),
ISPICKVAL(Business_Unit__c, ""),

ISBLANK( Account.Name),
ISPICKVAL(Customer_Program_Name__c, ""),
ISPICKVAL(Customer_Program_Phase__c, ""),
ISBLANK(Name),
ISPICKVAL(Country__c,""),
ISBLANK(End_User_b__c),
ISPICKVAL(Site__c , ""),
ISPICKVAL(Legal_Entity_Prime_Contractor__c,""),
ISPICKVAL(Country_of_Legal_Entity__c,""),
ISPICKVAL(Ex_group_Intra_group__c, ""),
ISPICKVAL(Domestic_Import_Export__c, ""),
ISPICKVAL(MIL_CIV__c, ""),
ISBLANK(RFP_Issue_Date__c),
ISBLANK(Proposal_Due_Date__c),
ISBLANK(CloseDate),
ISPICKVAL(Prospect_Type__c,""),
ISPICKVAL(Category__c,""),

ISBLANK(Contract_Duration_Mths__c),
ISBLANK(P1__c),
ISBLANK(P2__c),

ISBLANK(Amount),

ISPICKVAL(Currency__c,""),

ISPICKVAL(Bid_Category__c, ""),

ISPICKVAL(Capture_Lead__c, ""),
ISPICKVAL(Sales_Lead__c, ""),
ISPICKVAL(Sales_Manager_Country__c, ""),
ISPICKVAL(Sales_manager_Unit__c, "")
)

))