Skip to main content

I am trying to use Case function in Compute Expression to bucket Staff Role field values in to Clinical and non clinical type . but for some reason it show me this error after running dataflow . 

Something went wrong while executing the Adding Bucket Fields node: invalid field expression for field 'Clinical_NonClinical' [error category: USER]: Syntax Error at position [line 2: column 5] after token when :: ;Case ;when 'Staff_Role__; (02Kj0000000Kys4EAC_03C5b0000058PisEAE)

 

Reference screenshot of field : 

using Case Function in compute expression node in CRM analytics Dataflows

Syntax of Case function : 

 

Case 

when 'Staff_Role__c' == "A1A Clinical" then "Clinical staff"

when 'Staff_Role__c' == "A1A Commercial Manager" then "Non-Clinical staff"

when 'Staff_Role__c' == "A1A Commercial Staff" then "Non-Clinical staff"

when 'Staff_Role__c' == "Buy Up Commercial Manager" then "Non-Clinical staff"

when 'Staff_Role__c' == "Buy Up Commercial Staff" then "Clinical staff"

else "other" 

end 

 

please help me if you find any error in function syntax or something missing 

4 respuestas
  1. 17 nov 2023, 9:37 p.m.

    I would use '=', instead '==' to compare in Salesforce SOQL.

     

    You can try this as well:

     

    CASE 

      WHEN Staff_Role__c = 'A1A Clinical' THEN 'Clinical staff'

      WHEN Staff_Role__c = 'A1A Commercial Manager' THEN 'Non-Clinical staff'

      WHEN Staff_Role__c = 'A1A Commercial Staff' THEN 'Non-Clinical staff'

      WHEN Staff_Role__c = 'Buy Up Commercial Manager' THEN 'Non-Clinical staff'

      WHEN Staff_Role__c = 'Buy Up Commercial Staff' THEN 'Clinical staff'

      ELSE 'other' 

    END

     

    I hope that this can help you in some way.