Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Get option set values (D365) to insert row in dataverse

(0) ShareShare
ReportReport
Posted on by 19

Hi community,

 

I'm creating a power automate flow that inserts records in a dataverse table.

 

Challenge: The dataverse table contains fields that are connected to option sets. In order to insert the new row, I've tried to use the text value as custom value, but the execution of the flow is failing. Apparently I need to insert the ID of the value, not the text. In order to do so, I would need to dynamically get the available ID's of the option set, filter them by the one I want to insert, and then proceed adding the row, but I cannot really get access to the ID's of the option set.

 

alextriggle_0-1668615866833.png

 

The trigger of the flow is manual. The user has the option to define the values of each field that needs to be inserted as a row in the table "Touchpoints". As an example, there is a field called "Campaign" that has an option set in the Dataverse. If the user selects "home" in the manual trigger, I try to pass the text "home" as custom value (because I want it to be dynamic for future executions), but flow is asking me to use the ID of the option set for "seat"...

 

The 'inputs.parameters' of workflow operation 'Add_a_new_row' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/trg_campaign' is required to be of type 'Integer/int32'. The runtime value '"home"' to be converted doesn't have the expected format 'Integer/int32'.

 

As a solution, I tried to list all the OptionSets in my dataverse, to detect the "Campaign" dataset, and try to list it's ID's, but I got the following error:

 

alextriggle_1-1668616237970.png

 

Does any one have a solution to get OptionSet IDs on the fly that can then be used to insert a row in dataverse that has an OptionSet field in the record?

 

Thanks and regards

 

  • KRees Profile Picture
    on at
    Re: Get option set values (D365) to insert row in dataverse

     The empty function worked, thank you!

  • Ellis Karim Profile Picture
    11,105 Super User 2025 Season 1 on at
    Re: Get option set values (D365) to insert row in dataverse

    HI @Xch21 

     

    (1) You could use the empty function 

    if(empty(outputs('Get_response_details')?['body/**********']),'EMPTY','NOT EMPTY' )

     

    (2) Or try the Switch action, using the Default option to handle the Null or empty value:

     

    Snag_1a457420.png

    Snag_1a40a25c.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • KRees Profile Picture
    on at
    Re: Get option set values (D365) to insert row in dataverse

    Hi Ellis

    I wonder if you could help me with something similar.  I am building a flow that requires (choice) response from a CustomVoice Survey to land in a choice field in a dataverse table. In the flow I have created the following 'if' statement 

     

    if(equals(outputs('Get_response_details')?['body/**********'],'A'),1,

    if(equals(outputs('Get_response_details')?['body/**********'],'B'),2,

    if(equals(outputs('Get_response_details')?['body/**********'],'C'),3,'')))

     

    This works really well if the user selects options A, B or C.  The problem is if the user does not select any option and leaves the question blank. Do you have any advice in this instance please?  I have tried '', '0' and 'Null' neither seem to work (it requires an Integer)

    Xch21_0-1669204292827.png

     

    Thanks in advance

  • alextriggle Profile Picture
    19 on at
    Re: Get option set values (D365) to insert row in dataverse

    Hi @ekarim2020,

     

    I was looking for a dynamic solution to get the values on the fly, thanks for sharing the link that provided a suitable solution to my need.

  • Verified answer
    Ellis Karim Profile Picture
    11,105 Super User 2025 Season 1 on at
    Re: Get option set values (D365) to insert row in dataverse

    Hi @alextriggle ,

     

    You can get to the Option or choice from Power Automate by selecting Data>Tables which will take you to Power Apps. Then select Choices:

     

    2022-11-16_23-29-39.gif

    Snag_69c9729.png

    ekarim2020_0-1668641578929.png

    See also: Re: Switch - Power Platform Community (microsoft.com)

    To try and get the option set values on the fly, try the following: 

    Re: Get Dataverse Choices with Label and ID(Value) - Power Platform Community (microsoft.com)

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1