[SalesForce] Workflow rule field update – how to set picklist value dynamically using formula

In Workflow rule field update, is there any way to set a picklist type field value dynamically based on another field? I see formula based updates available for text type field, but for picklist I'm forced to choose only one value.

If this capability is unavailable, is there an alternative to avoid creating multiple workflow rules for a given field update driven by another field in a different related object? I'm already aware of the Before Insert trigger approach, and I don't prefer that because it adds a new SOQL to traverse to a related object and find a description.

For e.g. a Vehicle Type object with ID and Type Description has static data with multiple vehicle types. Vehicle object has a lookup field Vehicle Type ID relating to the ID field of Vehicle Type object. Each Vehicle Type is associated with a Record Type so the UI can be rendered accordingly. Before inserting a record into Vehicle object I want the Record Type field to be set according to the Vehicle Type chosen on the picklist.

Best Answer

Using the Flow Builder, you can create a record-triggered Flow to do this for you.

  1. Create a record-triggered Flow to run when record created or updated, before save.
  2. Choose your object.
  3. Add a condition to match the business need "dynamically based on another field" i.e now pick whatever field you are looking to check before determining what the subsequent picklist value will be.
  4. Create a Decision block with the number of outcomes that match the conditions to match the field from step 3 to the picklist values.
  5. Create any number of Assignment blocks to link each outcome to their respective picklist value.

Below is an example where I check a Boolean value in my Decision block and then based on true/false, two assignment blocks will mark the record picklist field as active or not.

enter image description here

Using the Process Builder, you can define a Process that will also do this for you and offers more complexity if ever needed.

  1. Choose Object and Specify When to Start the Process
  2. Create a criteria and action for each action group i.e if field A is XXX value, set picklist to YYY
  3. Each immediate action is expected to be an "update record" action where you assign the picklist value
  4. Note, in you action you should choose "Select the Account record that started your process"

Below is an example where I again check a Boolean value in my two criteria blocks and then based on true/false, two immediate action blocks will mark the record picklist field as active or not.

enter image description here

Related Topic