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

Community site session details

Session Id : 25dloC/Wf3wXC4cZE7BgYt
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 16 Nov 2022 16:31:33 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

 

I have the same question (0)
  • KRees Profile Picture
    on 24 Nov 2022 at 16:37:29
    Re: Get option set values (D365) to insert row in dataverse

     The empty function worked, thank you!

  • Ellis Karim Profile Picture
    11,328 Super User 2025 Season 2 on 23 Nov 2022 at 13:38:58
    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 23 Nov 2022 at 11:52:35
    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 23 Nov 2022 at 08:15:17
    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,328 Super User 2025 Season 2 on 16 Nov 2022 at 23:41:39
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 954 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 650 Moderator

#3
trice602 Profile Picture

trice602 327 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete