+ Start a Discussion
Pankaj Pandey 22Pankaj Pandey 22 

validation Rule if the Checkbox is checked then fields are required for Specific Record Type

Hi All,,

I am writing the Validation rule for specific record type on check of check box i want the mobile field to become madator. I have written below code and it is not working :-

IF( RecordType.DeveloperName  = "Testing", AND(Text_Consent__c = True, ISBLANK(MobilePhone__c)), NULL)

If I just write below code it works fine :-
AND(Text_Consent__c = True, ISBLANK(MobilePhone__c))

Any idea what is going wrong when i am adding the record type.

Thanks,
Pankaj Pandey
 
Best Answer chosen by Pankaj Pandey 22
UC InnovationUC Innovation
I dont think i understand what this validation rule is checking for. A validation rule will give an error if the formula is true so I dont think you will need the if statment in there. If you do try this instead

IF(RecordType.Name  = 'Testing', AND(Text_Consent__c = True, ISBLANK(MobilePhone__c)), false)

Personally think it was due to the DevName VS name that you were using also might want to try single quotes and null can not be returned. The explaination for the if statement is below:

IF(logical_test, value_if_true, value_if_false)

Hope this helps!

AM

All Answers

UC InnovationUC Innovation
I dont think i understand what this validation rule is checking for. A validation rule will give an error if the formula is true so I dont think you will need the if statment in there. If you do try this instead

IF(RecordType.Name  = 'Testing', AND(Text_Consent__c = True, ISBLANK(MobilePhone__c)), false)

Personally think it was due to the DevName VS name that you were using also might want to try single quotes and null can not be returned. The explaination for the if statement is below:

IF(logical_test, value_if_true, value_if_false)

Hope this helps!

AM
This was selected as the best answer
Magesh Mani YadavMagesh Mani Yadav
Hi Pankaj,

Try to use this in your validation rule.Should work and replace 'testing' with a valid recordtype developername.
AND(RecordType.DeveloperName='Testing',Text_Consent__c = True, ISBLANK(MobilePhone__c))

 
Pankaj Pandey 22Pankaj Pandey 22
Hi AM,

thanks for the quick reply. What if if have two check box and both are not checked then make some field madatory for same Record Type.

Thanks,
Pankaj Pandey
UC InnovationUC Innovation
just to clarify. Are you asking if you can make a field mandatory if both checkbox fields are not checked?

If this is what you are asking you might have to try a VF page and require the firld if it meets your criteria
Harish Kumar 171Harish Kumar 171
any one help me with this

there are two fields i.e., in time and out time and one checkbox absent.
if the checkbox absent is checked it should not allow us to enter intime and outime 
can anyone give me validation rule for this?