Create Formula Field That Append Text To Picklist Values

Introduction

There is need sometimes to create formula field that append text to picklist values to gives you control of how the data in your Salesforce organization is displayed. Formulas in Salesforce are a powerful tool that enable you perform calculations and other operations on your organization’s data. For example, using formulas, you can embed hyperlinks, perform arithmetic calculations with existing fields, or use conditional logic to display an amount.

In this post, I will append the year a record is created as a text to the values of a given picklist field on a Contact object.

A picklist field lets you choose a value from a pre-populated list. Even though you cannot write a formula that returns a picklist as a result, you can reference picklists in your formula fields.

Choosing the picklist field as per your use case. For this post, the picklist field on Contact object is Type and its values are in the screenshot below

values

To create formula field that append text to picklist values selected, go to the object Custom Fields & Relationships in Classic or Fields & Relationships in Lightning.

Click New,
Select Formula and click Next
Enter the Field Label that follows your naming convention. the Field Name will populate automatically if you click on anything on the page. For this post, Contact Group is used and text to append is the year the Contact record is created.
On the page, select Text radio button

text

Click Next and on this page click Advanced formula
Paste this code in the textarea
TEXT(Type__c) & “ “ & TEXT(YEAR(DATEVALUE(CreatedDate)))

Where Type__c is a picklist field with values pasted above and & “ “ & concatenates the picklist values, space between the picklist values and the year to be appended

 To extract only the year from a Date or Date/time field and display it as a text, use:
TEXT(YEAR(DATEVALUE(CreatedDate))) 
Click Check Syntax to make sure there is no error just like this

Then click Next, Next and Save.

Go to the object Page layout to make sure it is included. If not, drag it into the page layout and click Quick Save and then Sav

Note: Formula fields are not displayed on the new/edit pages but appears on the detail page.

Create a new Contact record.

Make sure you select a value for the Type field like the one below

On the Details Page, the Contact Group field is displayed as expected – the value of the picklist and year 2022 appended

Contact me if you have any question

Reference

Trailhead