Ui-Only Field using Case Formula

  • 1
  • Question
  • Updated 9 months ago
  • Answered
Hello there, I'm attempting to create a series of ui-only formulas on a page layout. I'm using a case formula, that evaluates a Salesforce field {{ANI_Segmentation_Row__cc}}, which is a picklist, and should return text "Yes" or "No".  The Display Type on the field is set to Formula and the Formula Return Type is text, but the formula returns the default value "No" for all segmentation rows as of now.



CASE({{ANI_Segmentation_Row__c}},
'CMNSS1', 'Yes',
'CMNSS2', 'Yes',
'CMNSS4', 'Yes',
'CMNSS5', 'Yes',
'CMSS1', ‘Yes',
'CMSS3', ‘Yes’,
'K12NCM1', ‘Yes’,
‘K12NCM2’, ‘Yes’,
‘OK12W1’, ‘Yes’,
‘OK12W2’, ‘Yes’,
‘OK12W3’, ‘Yes’,
‘PNSL1’, ‘Yes’,
‘PNSL2’, ‘Yes’,
'PNSL3', 'Yes',
‘SLFS1’, ‘Yes’,
‘SLFS2’, ‘Yes’,
‘SSANR1’, ‘Yes’,
‘SSNCM1’, ‘Yes’,
‘SSNCM2’, ‘Yes’,
‘SSNCM3’, ‘Yes’,
‘No’)
Photo of Melody

Melody

  • 130 Points 100 badge 2x thumb

Posted 9 months ago

  • 1
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 4,736 Points 4k badge 2x thumb
Is there a difference between the Value and the API Name on the Picklist setup? The CASE statement will operate on the API Name.

Conditions also operate on the API Name. The Value is what will be displayed in a Field Editor or Table.

I would display ANI_Segmentation_Row__c in a table, along with the UI-Only field. I would also add another UI-Only, formula field where the formula is simply {{ANI_Segmentation_Row__c}}. Something not quite obvious might show up.
Photo of Zach McElrath

Zach McElrath, Employee

  • 54,226 Points 50k badge 2x thumb
Mike's suggestion is a good one --- definitely make sure that there isn't a difference between the Picklist value and label.

I'm not sure if this will cause a problem, but I did notice that some of the quotation marks in your formula are the "curly" variants ’ and ‘ , so the Formula parser might not like those. Try this instead (I just replaced all of the "curly" quotes with regular single quotes:

CASE({{ANI_Segmentation_Row__c}},
'CMNSS1', 'Yes',
'CMNSS2', 'Yes',
'CMNSS4', 'Yes',
'CMNSS5', 'Yes',
'CMSS1', 'Yes',
'CMSS3', 'Yes',
'K12NCM1', 'Yes',
'K12NCM2', 'Yes',
'OK12W1', 'Yes',
'OK12W2', 'Yes',
'OK12W3', 'Yes',
'PNSL1', 'Yes',
'PNSL2', 'Yes',
'PNSL3', 'Yes',
'SLFS1', 'Yes',
'SLFS2', 'Yes',
'SSANR1', 'Yes',
'SSNCM1', 'Yes',
'SSNCM2', 'Yes',
'SSNCM3', 'Yes',
'No')
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 4,736 Points 4k badge 2x thumb
A sharper eye than mine, Zach! Do not copy-paste from Word!
Photo of Melody

Melody

  • 130 Points 100 badge 2x thumb
Hi all! Thanks so much for your help - I was able to resolve the issue by adding a condition connecting the contact record ID to the ID page parameters. I was able to figure this out by creating a table of the relevant fields and connecting the dots. Thank you so much!