Salesforce Admin · Salesforce Basic

How to get Picklist value in Formula Field.

When it comes to picklist in formula fields, there are few things which developer need to consider.

  1. Do you want picklist actual value (return text value)?
  2. Do you want to check if user has selected a specific value (return true or false.)?

There are 3 functions that can be used for different purpose to work with picklists in formula field.

  1. ISPICKVAL()
  2. CASE()
  3. TEXT()
  1. ISPICKVAL()

Syntax:

ISPICKVAL(<Picklist_Field>, ‘Text Value To Compare’)

Return Type: Boolean

This function returns TRUE if the picklist value matches the text value mentioned. Else returns false. This can be combined with other functions like, IF, AND, OR etc.

Example:

ISPICKVAL(Stagename, ‘Closed-Won’)

2. CASE()

Syntax:

CASE(<Picklist_Field>, 
‘Case_1’, ‘Value_1’,
‘Case_2’, ‘Value_2’,
‘Case_3’, ‘Value_3’,
‘Case_4’, ‘Value_4’,
‘Default_Value’)

Return value as per the match with CASE key selected in Picklist field.

This function can return any value, like text or Boolean or number. It all depends on what value you want to return based on the picklist value. You can also use IF, AND, OR and other conditions to fetch specific value as per requirement.

Example:

CASE(Stagename,
‘Closed-Won’,’Green’,
‘Closed-Won’,’Red’,
‘In Progress’,’Blue’ ,
‘Qualification’,’Orange’,
‘Needs Analysis’,’Orange’,
‘White’)

3. Text()

Syntax:

TEXT(<Picklist_Field>)

Return type: String

This function will return the text value that is selected in the picklist field. Usually this is used as a combination with other conditions in formula field.

Example:

Text(Stagename)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s