Get choices names in flows

In my previous post, I described how you could retrieve the labels of a choices column (multi-select optionset attribute) using a classic Dynamics Workflow. In this new article, I describe how to do the same using a Power Automate flow.

Using a classic Dynamic workflow is still a valid solution. However, if you are creating an asynchronous process, classic workflows are not recommended any more:

So a Power Automate flow is the way to go if your solution can run asynchronously.

My initial thoughs were: “ok, so I can create some kind of extension in Power Automate to retrieve those labels as I was doing with the GetMultiSelectOptionSet custom workflow activity for classic workflows”. This extension could have been a process action or one of the new Custom API function. However, before jumping into the code, I decided to run some tests and I realised that no development was required 😏

Using the latest recommended CDS connector (Common Data Service (current environment)), you can now retrieve the labels for Choice or Choices columns (optionset or multi-select optionsets). You just need to follow these steps:

  1. Use the action Get a record to retrieve the labels. Triggers currently do NOT provide the labels.
Get a record action retrived formatted choices labels

2. Apply an expression such as “outputs(‘NAME_OF_PREVIOUS_STEP_GET_RECORD’)?[‘body/COLUMN_NAME@OData.Community.Display.V1.FormattedValue‘]

Expression used to retrieve formatted choices labels

In this simple test case, I got a Car and related Car Review tables. When the car is created or changes, a new car review is created with the colors information.

Choices labels separated by semicolon by default

If you want to learn more about this and other similar scenarios, I would also recommend to have a look at this great article from Linn Zaw Win.

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