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
Alejandro Ruz CarrascoAlejandro Ruz Carrasco 

Weird validation rules behavior, some user get errors, most of them do not

We're having a strange situation, kinda hard to follow up.

We have two validation rules on Accounts, basically they validate if a calculus over a value results in the second value.

On accounts we use two recordtypes, and each recordtype has its corresponding validation rule to evaluate.

Also, the fields evaluated in each validation rule are different, and are only shown in their respective page layout.

For some users, both validation rules are being evaluated, thus failing the account creation.

This are the validation rules:
 
IF( RecordType.Name = "Cuenta personal",
IF (
CASE( (11 - ( Validacion_RUT_1_Persona__c - Validacion_RUT_2_Persona__c )) , 1,"1",2,"2",3,"3",4,"4",5,"5",6,"6",7,"7",8,"8",9,"9",10,"K",11,"0", "ERROR" )
= mid ( Rut_contacto__pc & "-" & UPPER(DV_contacto__pc) , len(Rut_contacto__pc & "-" & UPPER(DV_contacto__pc)) , 1 )
, FALSE, TRUE )
,FALSE)
IF ( RecordType.Name = "Cuenta Corporativa",
IF (
CASE( (11 - ( Validacion_RUT_1__c - Validacion_RUT_2__c )) , 1,"1",2,"2",3,"3",4,"4",5,"5",6,"6",7,"7",8,"8",9,"9",10,"K",11,"0", "ERROR" )
= mid ( Rut__c & "-" & UPPER(DV__c) , len(Rut__c & "-" & UPPER(DV__c)) , 1 )
, FALSE, TRUE )
,FALSE)
My guess and analysis shows that always both validation rules, irregardless of the recordtype, are evaluated, and given that the fields in one of them are empty the validation fails, halting the creation process.

But that doesn't explain how most of our users don't have this problem and only a handful are experiencing this.

I've tried with all the browsers, both POSTs send the recordtypeid, and a coworker right next to me, filling the fields and saving the account, entering the same values as i did, created the account successfully.

Should i create a case for this?

Thanks in advance
Darshan Shah2Darshan Shah2
Hi Alejandro Ruz Carrasco,

Check whether profile has recordtype access or not.
Alejandro Ruz CarrascoAlejandro Ruz Carrasco
Hi Darshan

Just checked the profile (i'm sysadmin) and i have access to both recordtypes
Muralidhar S (Salesforce)Muralidhar S (Salesforce)
Alejandro,

Is the Language settings for all the users same? Since the Record type name may be different for each Running User, depending on the user's language. So the Record Type Name "Cuenta personal" or "Cuenta Corporativa" might be different for users having different Language settings (say English) and therefore the comparison will fail. 
Darshan Shah2Darshan Shah2
Hi Alejandro,

Actually I was asking to check profile for that users who is getting error.
If they have access to above record types then just try to use 'RecordType.DeveloperName' instead of 'RecordType.Name' in IF condition.

Kindly let me know whether it solves your problem or not.