Get label instead of API name in salesforce formula

formulaformula-fieldimage-formula

I am trying to add image plus text value to a field in the case object. In the below formula I am adding an icon based on the Type picklist value chosen and also at the end appending the label of the picklist item chosen instead of the API name.

IMAGE(CASE( Type,
'Billing', '/resource/CaseIcons/Billing.svg',
'Service', '/resource/CaseIcons/Service.svg',
'Technical', '/resource/CaseIcons/Technical.svg',
'Retention', '/resource/CaseIcons/Retention.svg',
'Account Action', '/resource/CaseIcons/AccountActions.svg',
'/s.gif'), "Issue Type") + " " +  (CASE(Type,
"Billing","Billing",
"Service", "Service Change",
"Technical","Technical",
"Retention","Retention",
"Account Action","Account Action"
))

I am getting this error when check the syntax –
Error: Incorrect number of parameters for function 'CASE()'. Expected 10, received 11

The final result I am looking for is image plus the label of the picklist item selected like in the image attached.enter image description here

Best Answer

Your missing a default case on your second case statement

IMAGE(CASE( Type,
'Billing', '/resource/CaseIcons/Billing.svg',
'Service', '/resource/CaseIcons/Service.svg',
'Technical', '/resource/CaseIcons/Technical.svg',
'Retention', '/resource/CaseIcons/Retention.svg',
'Account Action', '/resource/CaseIcons/AccountActions.svg',
'/s.gif'), "Issue Type") + " " +  (CASE(Type,
"Billing","Billing",
"Service", "Service Change",
"Technical","Technical",
"Retention","Retention",
"Account Action","Account Action",
"ErrorError"
))
Related Topic