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
KsteadKstead 

Validation Rule Help

I've created a validation rule that allows for a field to become mandatory when it meets certain requirements; works great.  However I now need to have this rule not apply to a specific record type and I'm having problems adding it to the rule.

 

Here's the original rule:

AND( OR( BEGINS( "FL", Account_State_Province__c ), BEGINS("USA",  Account_Country__c ) ),   ISBLANK( TEXT( Agent_Sales_Rep__c )))

 

the record type is called BBA_Service_Programs and the Id is 01250000000UKIF

 

I tried adding it on the end using AND but it keeps coming up with errors.

 

Help is appreciated!

 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Okay you don't want the DeveloperName and you also don't wan't the API Name of the Record Type, you want the literal name, so your VR will kinda look like this:

AND(
$RecordType.Name = "BBA Strategic Account Opportunity",
OR( BEGINS( "FL", Account_State_Province__c ), 
BEGINS("USA",  Account_Country__c ) ),   
ISBLANK( TEXT( Agent_Sales_Rep__c )))

 

All Answers

Steve :-/Steve :-/

Can you post the Formula and errors you're getting?  Something like this should work.

 

AND(
$RecordType.Name = "The RecordType Name",
OR( BEGINS( "FL", Account_State_Province__c ), 
BEGINS("USA",  Account_Country__c ) ),   
ISBLANK( TEXT( Agent_Sales_Rep__c )))

 

KsteadKstead

Hi STeve,

 

doesn't seem to be working and with the testing I don't think my original validation rule is working properly; not pulling out FL for Florida.

 

I can't seem to past the error in here.  But get and error from the Record Type that shouldn't have the error on.

 

So here's what I want.

 

If the Account_Country-c is USA and Account_State-Province-c is FL then Agent Sales Rep field to be mandatory.  Not on the following Record Types BBA_Service_Programs and BBA_Strategic_Account_Opportunity.

 

thanks!!

 

KsteadKstead

Here's the rule

 

AND(  $RecordType.DeveloperName  = "BBA_Strategic_Account_Opportunity",OR( BEGINS( "FL", Account_State_Province__c ), BEGINS("USA",  Account_Country__c ) ),   ISBLANK( TEXT( Agent_Sales_Rep__c )))

Steve :-/Steve :-/

Okay you don't want the DeveloperName and you also don't wan't the API Name of the Record Type, you want the literal name, so your VR will kinda look like this:

AND(
$RecordType.Name = "BBA Strategic Account Opportunity",
OR( BEGINS( "FL", Account_State_Province__c ), 
BEGINS("USA",  Account_Country__c ) ),   
ISBLANK( TEXT( Agent_Sales_Rep__c )))

 

This was selected as the best answer
KsteadKstead

You Rock Steve!!!  thanks was the name thing; all looks good; added another Record type Syntax good!

 

thanks again!