I need to create a validation rule that fires where when either "Complete" or "Closed" is chosen from a picklist, another picklist becomes a required field. I have tried multiple options, but have not had luck yet. So far this is what I have tried:

   ISPICKVAL(Status__c, "Complete" || ISPICKVAL (Status__c, "Closed"),

Both Root_Cause__c and Status__c are picklists.

I am currently getting a FIELD_CUSTOM_VALIDATION_EXCEPTION error on the page. Anyone have any ideas?

  • What is the data type of Root Cause?
    – sfdcfox
    Oct 24, 2019 at 16:03
  • @sfdcfox It is also a picklist
    – Leah G
    Oct 24, 2019 at 16:59
  • Leah, please edit your post with any clarifications. Comments are good for asking for clarification, but providing it should be done by making the Question itself more clear.
    – Adrian Larson
    Oct 24, 2019 at 17:05

2 Answers 2


Start with your root criterion, namely this other field being null. The approach may vary based on field type, but that might look like:


EDIT Now that you have explicated this field to be a picklist, you can change this check to:

ISPICKVAL(Root_Cause__c, "")

Now layer on top of that your check on the value of Status. You can do it the way you have, but please try to always use functions instead of && and ||, as that will be more consistent with the rest of your formula. So it would be better to do:


Better yet, though, is to use a CASE function so that you only reference the field once (field references are expensive):

1 = CASE(Status__c, "Complete", 1, "Closed", 1, 0)

Now the field you actually want to check if it changed should also be this status field. Putting it all together:

    ISPICKVAL(Root_Cause__c, ""),
    1 = CASE(
        "Complete", 1,
        "Closed", 1,
  • Thanks Adrian. When I check syntax in the formula editor, I am still getting this error message: Error: Field Root_Cause__c is a picklist field. Picklist fields are only supported in certain functions
    – Leah G
    Oct 24, 2019 at 17:02
  • @LeahG Hence why sfdcfox asked you to clarify your question. I have updated my post accordingly.
    – Adrian Larson
    Oct 24, 2019 at 17:04
  • 1
    Thanks Adrian. I am still only a few months into working with Salesforce so I am still learning! I appreciate the help!
    – Leah G
    Oct 24, 2019 at 17:09

Your page is a visualforce page? if so, you need to use 'try catch' like below code.

Account acc = new Account();
acc.Name = 'ABC';
try {
    insert acc;
} catch (DmlException e) {
for (Integer i = 0; i < e.getNumDml(); i++) {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDmlMessage(i)));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .