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
Russel MendozaRussel Mendoza 

IF statement to determine if the field is equal to a certain word validation rule.

Hi Team,

I'm working on a FLOW right now and I created a new variable which looks like ({!make}. So the validation should go like if the make is = to the word "INFINITI" the repair Repair/WO Number should only have 5 characters. Else it should be 7 characters. 

Sample below:

IF(
({!make} = "INFINITI"),
LEN({!Repair_WO_Number}) < 6,
else LEN({!Repair_WO_Number}) < 8
)

I don't think this is correct and I'm not sure if I need to use the ISPICKVAL for this. 

Any help is greatly appreciated.
Best Answer chosen by Russel Mendoza
GauravGargGauravGarg
Hi Russel,

Are you working in VF or sfdc validation rule? SFDC Valiation rule should like below
 
IF( make__c = "INFINITI", 
LEN(Repair_WO_Number__c) < 6,
LEN(Repair_WO_Number__c) < 8
)

Hope This Helps!!!

Thanks,
Gaurav
Skype: gaurav62990

All Answers

GauravGargGauravGarg
Hi Russel,

Are you working in VF or sfdc validation rule? SFDC Valiation rule should like below
 
IF( make__c = "INFINITI", 
LEN(Repair_WO_Number__c) < 6,
LEN(Repair_WO_Number__c) < 8
)

Hope This Helps!!!

Thanks,
Gaurav
Skype: gaurav62990
This was selected as the best answer
Russel MendozaRussel Mendoza
Hi GauravGarg,

Following the format that you suggested. I tried to put in the below rule.

IF( Make_Name__c = "INFINITI",
LEN(Repair_WO_Number__c) < 6,
LEN(Repair_WO_Number__c) < 8
)

Unfortunatly, I received an error when I tried to go that flow page.
GauravGargGauravGarg
Russel,

Can you post the error message.

Thanks,
Gaurav
Russel MendozaRussel Mendoza
Thanks for the Help. I manage to make it work using the idea you provided. 

I played around with the code and resulted to the below's code:

IF(
({!make}) = "INFINITI",
LEN(Repair_WO_Number) < 6,
LEN(Repair_WO_Number) < 8
)

Thanks again.