Menu

How to display text paragraph based on a picklist in Salesforce

You have a picklist field in Salesforce with different values like A, B, C. The content in template will be dependent on which picklist value is selected.

For example, in Salesforce. you have a field called "Opening Words". Depending on the option, the opening text in the document will be based on those option.

1. Create the text in the template

In the template, type in the text you want to display in different paragraphs

2. Add condition to each paragraph

Click to the text in Option A. You will see the grey bar on the side of the text, indicating you are selecting the whole paragraph.

In the right pane, click the "..." icon in If attribute

The Source will open so you can select the Salesforce field to be the condition.

Select the Object and the field.

Click Add condition

The field API will be populated in the Condition box. Select the equation and add the picklist value you want to compare. Because it's picklist value, the criteria must be case sensitive and insde the  single quotation mark 'Option A'

Click OK.

You can also write the syntax manually using Expression Language (EL).

Continue the same process with other options or copy and edit the syntax in If attributes

When you click to the paragraph. the grey bar on the side will turn into blue, indicating there is dynamic content in that paragraph.

Notes:

  • Since we add the condition to the whole paragraph, if you want to update a new text for each Option, edit in the corresponding paragraph.
  • If you replace the whole text with a new paragraph, ensure the new paragraph has the right condition by checking the side bar and the If attribute
  • If there is no value selected in the picklist field, (value is "None"), none of the paragraph will be displayed. You can have another paragraph to be displayed when the picklist value equals to null

Comments

0 comments