Personalized Community is here!
Quickly customize your community to find the content you seek.
Spotlight Hall of Fame
Check out the Dynamics 365 community all-stars!
2023 Release Wave 1Check out the latest updates and new features of Dynamics 365 released from April 2023 through September 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Dataverse multiselect choice column type metadata has labels and corresponding integer values. While labels are used for the user interface, internally the system uses the corresponding integer values. Integrating services/systems are also required to use the integer values.
For example, the Dataverse Connector requires integer value inputs while creating or updating records that has multiselect choice columns values.
This integer input requirement could make it challenging to author and maintain your Flows when the source system is only providing the labels and does not have the integer values. For example, The Microsoft Forms only has text labels. In such scenarios, you can hard-code the integer values mapped to the text labels while creating or updating records in Dataverse from the Flow, but hard coding is not ideal.
The Dataverse Web API can come in handy, using which you can retrieve the complete metadata. Below are the request and response examples in screenshot 2 and 3.
As you can see, the Web API response has much more information along with the label and the integer value for each value in the Choice column. You can use choice options from the response body by using the expression: body('Invoke_an_HTTP_request_-_Get_Choices')?['Options']
and put it through an ‘Apply to each’ loop:
Inside the loop, parse the option as JSON so subsequent action(s) can refer the Value and the Label. You can generate the schema using one of the option objects from the response body.
The next action is to append the Label and the Value from the “Parse Current Choice JSON ” output of the current item using these expressions; refer to screenshot 6 for visual.
Upon loop completion, the “choicesMetadata” array looks like screenshot 7:
I am attaching a sample cloud Flow following the above method. This flow can be triggered manually by providing the API URL and the choice column schema name. When executed, it returns an array which includes the labels and the corresponding integer values that you can consume in your parent flow by parsing it as JSON; like screenshot 8.
Hope this helps!
Business Applications communities