[SalesForce] validation rule for text field to be changed

Validation rule for Text field –

It should be not blank OR if any value already in text field then it should be changed.

Based on two conditions:

  • Picklist value should be Rejected
  • RecordType.devloperName should be 'RecordUpdate'

I started by writing below rule.

   ISPICKVAL(Status__c,'Rejected') , 

Best Answer

If I understand your question correctly, the validation rule should fire based on following conditions:

  • If Comments is blank OR if any value already in text field and it doesn't changed
  • When Picklist value is Rejected
  • RecordType.devloperName is 'RecordUpdate'

Then throw the error message.

The rule will be like this:

RecordType.DeveloperName = 'RecordUpdate'
&& ISPICKVAL(Status__c,'Rejected')
&& (ISBLANK(Comments__c) 
    || NOT(ISCHANGED(Comments__c))
Related Topic