0

I am trying to create an nested IF AND conditional statement to look at case severity and time (hrs) it took to reach a certain case status. I have tried the below but keep getting the error

"Warning Error when encoding row-level formula: Field Case.b1_case_severity__c is a picklist field. Picklist fields are only supported in certain functions."

From what I have searched I may need to use CONTAINS(TEXT( but don't know where I would apply it in the formula.

IF(
AND(Case.b1_case_severity__c, "1 - Critical",
Case.Flexible_SLA_Time__c > 9.5),1,
IF(
AND(b1_case_severity__c, "2 - High",
Case.Flexible_SLA_Time__c > 9.5),1,
IF(
AND(b1_case_severity__c, "3 - Medium",
Case.Flexible_SLA_Time__c > 19),1,
IF(
AND(b1_case_severity__c, "4 - Low",
Case.Flexible_SLA_Time__c > 28.5),1,0))))  
3
  • Welcome to Stack Exchange. Most of the questions here are pretty Apex and JavaScript centric. You might get a faster response on the Trail Blazer forums where there is more of an Admin focus. Commented Oct 27, 2021 at 12:55
  • 2
    @BrooksJohnson We handle all aspects of Salesforce and many Salesforce-related products. It just so happens that most of the questions are about code, but we handle formulas, validation rules, reports, and anything else that is is in Salesforce (though, notoriously, we rarely handle unit-test, because they're usually low quality).
    – sfdcfox
    Commented Oct 27, 2021 at 12:59
  • Ohh for sure, I just thought he might get a faster response on a different forum. My intent was only to be helpful, not mislead. Commented Oct 27, 2021 at 13:00

1 Answer 1

2

To check a picklist value, use ISPICKVAL, as in ISPICKVAL(b1_case_severity__c, "1 - High"). However, you can be more efficient here by using CASE:

IF(Flexible_SLA_Time__c > 
    CASE(b1_case_severity__c, 
        "1 - Critical", 9.5, 
        "2 - High", 9.5, 
        "3 - Medium", 19, 
        "4 - Low", 28.5, 0),
    1,
    0
)
1
  • This works, thank you very much!
    – mtm1186
    Commented Oct 27, 2021 at 13:12

You must log in to answer this question.

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