0

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.

AND 
( 
   ISPICKVAL(Status__c,'Rejected') , 
   ISCHANGED(Comments__c)
) 
2
  • you didn't put recordtype condition in the rule Mar 17, 2019 at 10:04
  • I tried with record type but its not working.
    – Pervez
    Mar 17, 2019 at 10:17

2 Answers 2

0

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))
    )
2
  • Yes. When RecordType.DeveloperName = 'RecordUpdate' and Status__c is Rejected then Comment text field should not blank or if any value already in text field and it doesn't changed.
    – Pervez
    Mar 17, 2019 at 12:31
  • I tried your code but still not working, record is getting saved without changing the comment.
    – Pervez
    Mar 17, 2019 at 12:32
0

I think Santanu is close, but the OR condition is not quite right because we want to prevent both blank & unchanged comments when status is Rejected. Try this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.