web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dynamically Map Form I...
Power Automate
Suggested Answer

Dynamically Map Form Insurance Selections to Dataverse Option Set IDs in Power Automate

(0) ShareShare
ReportReport
Posted on by 8

I’m building a flow in Microsoft Power Automate that captures insurance information from a Microsoft Form submission. The goal is to map the selected insurance payer to the corresponding Option Set ID in Dataverse. The insurance information is a single-choice field on the form, and I need to pass the Option Set ID (integer) of the selected payer to a Dataverse table for further processing.

Current Flow Sequence:

Trigger: When a new response is submitted

Get Response Details: Form ID - Form selected from the trigger step

Compose Parse Insurance: Inputs - Output from Get Response Details

Compose Insurance Mapping: Expression:

createArray(
    if(contains(outputs('Compose_Parse_Insurance'), 'Aetna'), '428470000', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Aetna-Coventry Foreign Services Benefit Plan'), '428470001', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Aetna-Innovation Health'), '428470002', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Aetna-Meritain Health'), '428470003', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Kaiser'), '428470004', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Kaiser-KPIC'), '428470005', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Kaiser Medicaid'), '428470006', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Tricare Prime'), '428470007', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Tricare Select'), '428470008', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'I do not have insurance'), '428470009', null),
    if(contains(outputs('Compose_Parse_Insurance'), 'Other'), '428470009', null)
 
Add a new row: Insurance field mapped to output of compose insurance mapping

Form Insurance Field and Corresponding Option Set IDs:

The options in the form’s insurance field and their corresponding Option Set IDs in Dataverse are as follows:

  • Aetna: 428470000
  • Aetna-Coventry Foreign Services Benefit Plan: 428470001
  • Aetna-Innovation Health: 428470002
  • Aetna-Meritain Health: 428470003
  • Kaiser: 428470004
  • Kaiser-KPIC: 428470005
  • Kaiser Medicaid: 428470006
  • Tricare Prime: 428470007
  • Tricare Select: 428470008
  • I do not have insurance: 428470009
  • Other: 428470009

Test Run Error Message: Action 'Add_a_new_row_1' failed: The 'inputs.parameters' of workflow operation 'Add_a_new_row_1' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/ppts_insurance' is required to be of type 'Integer/int32'. The source type/format 'Array' of the value '[null,null,null,null,"428470004",null,null,null,null,null,null]' is not convertible to type/format 'Integer/int32'.

Question:

How can I dynamically map each payer from the form to its corresponding Option Set ID (integer) in Dataverse using Power Automate? I need to ensure that once an insurance option is selected in the form, the corresponding Option Set ID is passed as an integer to Dataverse.

I would appreciate any guidance in how to achieve this dynamically that allows for flexible mapping of values. 

Thank you for your assistance.

Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,244 Most Valuable Professional on at
    Since the form value comes in as text and you know the integer ID you can use a Switch to convert the text to an integer variable that you can then use to set the option ID.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
  • Suggested answer
    Mark Nanneman Profile Picture
    993 Moderator on at
    The way I prefer to to do things like this is to get your Dataverse Choice options into an array in your flow, and then filter the array.

    Something like:



    You can manually build the array, or you can use an Invoke a HTTP Request to get the options for a Choice Set dynamically from an API.

    There are APIs available for Dataverse Choice Sets:
    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/create-update-optionsets

    If you know the logical name (not display name) of your choice set, you can use this endpoint:
    https://<your-domain>.dynamics.com/api/data/v9.2/GlobalOptionSetDefinitions(Name='<your-option-set>')

    You can find the logical name of the choice set if you edit it in dataverse and check under "advanced"

     

    Invoke an HTTP Request to get the Choice Set Definition

    Set up the connection with your Dataverse url (https://<your-domain>.crm.dynamics.com)

    Then for the url of your request put 
    /api/data/v9.2/GlobalOptionSetDefinitions(Name='<your-option-set-name>')


     

    Filter the Option Values for the Choice Set

    The data output by the Dataverse GlobalOptionSetDefinitions API isn't structured in exactly the most straighforward way, the "Label" (display name) for each choice option is hidden in an array.  Still, it's easy enough to reference in a filter or select on the "Options" array property by using this expression:
     
    first(item()?['Label/LocalizedLabels'])?['Label']
     


    Connect a filter to the "Options" array from the Invoke an HTTP Request

    body('Invoke_an_HTTP_request_-_Get_Choice_Set')?['Options']

    Filter where 
     
    first(item()?['Label/LocalizedLabels'])?['Label']
    equals your search value.

    Here I just typed in Metropolis which is one of my options.
     


    Then I use a compose to display the value of the first item returned by the filter.




    Here it is in action:

    If this helped you, please click "Does this answer your question" and give it a like to help others in the community

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard