0

In our Case process builder, we current have a step where the status is set automatically depending on the value of a custom picklist field. The formula looks like this:

CASE([Case].CaseOutcome, 'Outcome A','Status A',
'Outcome B','Status A',
'Outcome C','Status B',
'Outcome D','Status C',
….
New)

There are three potential status types to be assigned and this formula, but a vast number of new outcomes have been added recently and we are in danger of breeching Process Builders 3900 character limit.

There are currently 85 outcomes to assign a status to;

55 will be given status A
20 will be given status B
10 will be given status C

What I am trying to do is change the formula so it will say something like this;

IF outcome = C, assign status B, ELSEIF outcome = D, assign status C, ELSE assign status A

I have managed an IF formula which will cover status B and A but not status C. Here is a sample of that formula;

IF((ISPICKVAL([Case].CaseOutcome__c, 'Outcome 1') || 
ISPICKVAL([Case].CaseOutcome__c, 'Outcome 2') ||
ISPICKVAL([Case].CaseOutcome__c, 'Outcome 3'),
'Status B', 'Status A')

This works perfectly EXCEPT, there is no way to assign status C.

I have looked through Salesforce formula documentation but haven't found a satisfactory solution. There doesn't seem to be an IF ELSEIF ELSE type formula, which is maddening and would be the exact solution I am looking for.

If anyone has encountered this issue themselves, I would love to hear how you got around it.

Thanks

1 Answer 1

1

You can nest IF functions to something like this:

IF(
    OR(
        ISPICKVAL([Case].CaseOutcome__c, 'Outcome 1'),
        ISPICKVAL([Case].CaseOutcome__c, 'Outcome 2'),
        /* 
        * Other Status B Choices Here...
        */      
    ),
    'Status B',
    IF(
        OR(
            ISPICKVAL([Case].CaseOutcome__c, 'Outcome 11'),
            ISPICKVAL([Case].CaseOutcome__c, 'Outcome 12'),
            /* 
            * Other Status C Choices Here...
            */
        ),
        'Status C',
        'Status A'
    )
)

This may still go over the limit depending on your available outcomes, and you may have to separate your logic into separate nodes and/or subprocesses, but the IF, ELSE IF, ELSE logic is handled here by nesting another IF function as the ELSE condition of the outer IF.

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.