Lädt...

🔧 Easily Get Numeric Dataverse Choice Set Value in Power Automate for a Text Value


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Sometimes in Power Automate you have a text value (string) and you want to use it to set a Choice Column in Dataverse. To do this, you need to get the numeric code value for that Choice Column Option. For large Choice Sets, it's impractical to use conditions. Fortunately there's a quick an easy way to get the required value using a Dataverse Web API endpoint.

Add an "Invoke an HTTP request" Entra ID action

We need to get a list of option values and their matching labels for our Choice Set in order to filter it based on the text on the submitted form. This can be done using a Dataverse Web API, which we can call with the "Invoke an HTTP request" action.

Image description

Add a connection and sign in

Use your Organization URL (first part of your url when you open a model-driven app) when creating the connection.

https://<organization-url>.crm.dynamics.com

Image description

You can also find it under "Developer Resources"

Image description

Construct a GET Method Request to the Solution Endpoint

We will use the "Retrieve Option Set" GET endpoint listed by Microsoft here.

/api/data/v9.2/GlobalOptionSetDefinitions(Name='<option-set-name>')?$format=application/json;odata.metadata=none
You will need to put the logical name of your Dataverse Choice Set in the endpoint after "Name='".

You can find the logical name of your choice set in Dataverse.

Image description

It will look like this in your flow:

Image description

Filter the Returned Options Array for a Label that Matches the Text Submitted

When the "Invoke an HTTP request" runs the Dataverse Web API Endpoint will return a complex JSON object defining the Choice Set with another complex array of Options for it.

Image description

We need to filter the included "Options" array to find the item with a label that matches our search string, so that we can grab the "Value" property of that item.

Image description

From:

Select the "Options" array from the HTTP response like this:

body('Invoke_an_HTTP_request_-_Get_Choice_Set')?['Options']
First Parameter:

The label is stored in each Option item under the following path, which we use in the first parameter of the filter:

item()?['Label/UserLocalizedLabel/Label']

Second Parameter:

The second parameter is the search string, in our case the "State" name submitted on the form.

Image description

Code View:

Image description

Get the Value of the Item Returned by the Filter

The filter will return the entire JSON object of the item with a matching Label. We only need the "Value" property.

Use a compose to grab this.

first(body('Filter_array_-_Options'))?['Value']

Input this Integer on the "Add a new row" Action

Image description

Thanks for reading!

Power Platform Developer | LinkedIn: Mark Nanneman | Wordpress | YouTube: Mark’s Power Stuff | Buy me a coffee

...

🔧 Easily Get Numeric Dataverse Choice Set Value in Power Automate for a Text Value


📈 100.61 Punkte
🔧 Programmierung

🔧 Get Localized choice values for Dataverse record


📈 35.7 Punkte
🔧 Programmierung

🔧 Working With Dataverse Tables in Power Automate


📈 35.37 Punkte
🔧 Programmierung

🎥 Inside the Microsoft Power Platform | Power Apps, Power Automate, Power BI and more


📈 31.84 Punkte
🎥 Video | Youtube

🎥 Low Code Revolution - Using MS Power Platform, AI builder, DataVerse and Power BI


📈 30.32 Punkte
🎥 Video | Youtube

🔧 Unlocking the Power of Dataverse in Microsoft Power Apps


📈 30.32 Punkte
🔧 Programmierung

🔧 UiPath vs Power Automate - Making the Right Choice


📈 27.3 Punkte
🔧 Programmierung

🕵️ Medium CVE-2020-28281: Set-object-value project Set-object-value


📈 26.94 Punkte
🕵️ Sicherheitslücken

🔧 Get Number Set Statistics with an Excel Online Script in Power Automate


📈 26.77 Punkte
🔧 Programmierung

📰 Golem Karrierewelt: Heute Webinar "Power Automate? Power Apps? Power was?"


📈 26.48 Punkte
📰 IT Nachrichten

📰 Golem Karrierewelt: Kostenloses Webinar: Power Automate? Power Apps? Power was?


📈 26.48 Punkte
📰 IT Nachrichten

🎥 Inside Microsoft 365: Power Apps? Power Automate? Power was?


📈 26.48 Punkte
🎥 Video | Youtube

🔧 Streamline Your Day: How to Automate Workflows with Microsoft Power Automate


📈 26.18 Punkte
🔧 Programmierung

🔧 Power Automate and React Integration: Automate Business Processes


📈 26.18 Punkte
🔧 Programmierung

🔧 Power Automate and React Integration: Automate Business Processes


📈 26.18 Punkte
🔧 Programmierung

🔧 Automate every Industry using Power Automate with Roma Gupta | #LessCodeMorePower


📈 26.18 Punkte
🔧 Programmierung

📰 Download Power Automate Desktop for Windows 10 to automate tasks and processes at no additional cost


📈 26.18 Punkte
📰 IT Nachrichten

🔧 How to (quickly) set Dataverse table icons


📈 26.05 Punkte
🔧 Programmierung

🔧 Power Platform Dataverse 101


📈 24.96 Punkte
🔧 Programmierung

🔧 PACX ⁓ Command Line Utility Belt for Power Platform / Dataverse


📈 24.96 Punkte
🔧 Programmierung

🎥 How to use Power Platform's advanced data backend for all your apps | Microsoft Dataverse


📈 24.96 Punkte
🎥 Video | Youtube

🔧 Power Platform - Moving All Flows to Dataverse


📈 24.96 Punkte
🔧 Programmierung

🔧 Use existing columns to create JSON data with Power Fx formula in MS Dataverse


📈 24.96 Punkte
🔧 Programmierung

🔧 Power Platform Let's Talk About Dataverse For Teams


📈 24.96 Punkte
🔧 Programmierung

🔧 4 ways to access data from Microsoft Fabric OneLake in Dataverse / Power Platform solutions


📈 24.96 Punkte
🔧 Programmierung

🕵️ CVE-2024-35260 | Microsoft Power Platform Dataverse untrusted search path


📈 24.96 Punkte
🕵️ Sicherheitslücken

🔧 Power Platform Dataverse


📈 24.96 Punkte
🔧 Programmierung

🔧 Getting "Start a Power Apps trial" when using Canvas with Dataverse even with a premium license.


📈 24.96 Punkte
🔧 Programmierung

🔧 Get SharePoint location for Dataverse record


📈 24.17 Punkte
🔧 Programmierung

🔧 Dataverse: custom telemetry setup with allowed POST and disallowed GET


📈 24.17 Punkte
🔧 Programmierung

🔧 5 ways to get your Dataverse Data into Microsoft Fabric / OneLake


📈 24.17 Punkte
🔧 Programmierung

🔧 Dataverse: get distinct values with Web API


📈 24.17 Punkte
🔧 Programmierung

🕵️ Apple Safari up to 4.0.1 Numeric Page Reference numeric error


📈 23.34 Punkte
🕵️ Sicherheitslücken

📰 Choice matters, choice happens


📈 23.06 Punkte
🐧 Unix Server

matomo