cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sk365
Helper I
Helper I

Multiselect option set mapping

Hi all,

im using Join action with JSON expression to map Multiselect option set but it throws an error saying invalid integers

Please look the below pics and advice on this.

468D5684-CF22-431B-922C-BA08C716231B.jpeg

BE6F7818-B4C8-4FEE-B36C-6C02D1939989.jpeg

6BC8EE44-F639-4549-A840-01C877EB6A1E.jpeg

967743DB-4E00-4E68-A661-A21EE2F379B3.jpeg

1 ACCEPTED SOLUTION

Accepted Solutions

You can use the same approach to update the record using values from your MS Form. 

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

 

Here is an example based on the linked post:

Snag_a020542.png

You can hard code each of the option set values into a variable of type (JSON) object. The text in the JSON object must match EXACTLY what you have in used in your MS Form for the options:

 

{
  "Green Apple": 544500000,
  "Blush Pear": 544500001,
  "Baby Banana": 544500002,
  "Honey Dew Mango": 544500003
}

 

 

ekarim2020_0-1656844538347.png

 

The Select actions takes the question "Choose one or more fruits" as its input (From). The From field uses an expression which converts the "Choose one or more fruits" response from MS Forms (which is a string!) into an array of JSON objects. You will need to wrap your question within the json action:

Snag_9ef4b7f.png

 

This is the expression for the Map:  variables('varChoices')?[item()]. This expression takes a Choice text (e.g. Blush Pear") , and returns the option set value.  For example variables('varChoices')?['Blush Pear'] would return 544500002. 
 
The Select action produces an array which we can use in Join action.

Snag_a03f99f.png 
The Join action returns all the items from the array as a string separated by the comma character.
 

Snag_9eff3d4.png

ekarim2020_2-1656845657323.png

Finally, we can update the field usng the output from Join action

Snag_9f294fc.png

ekarim2020_3-1656845884955.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.

View solution in original post

8 REPLIES 8
ekarim2020
Super User
Super User

Hi @Sk365 ,

 

With Datavese you can't use and assign the text descriptions for a choice field :

 

"Physical Therapy", 

 "Speech Therapy", 

 "Outpatient Mental Health Therapy"

 

Dataverse assigns an integer value for each choice option and you will need to find and use those values in the Add a row action.

 

For example, I want to update a row and change the choice of fruit to Apple and Mango. The field name I need to change is FruitChoice (in the Dataverse table the field's actual name is crc37_fruitchoice). I need to find the integer values for Apple and Mango:

 

Snag_4f0ec8e.png

The browser will open or switch to Power Apps:

Snag_4d92249.png

 

Snag_4df681e.png

Unfortunately the option set values are displayed with commas:

Snag_4dace91.png

These are the integer values for choice of fruit I extracted:

"Apple" = 544500000

"Pear" = 544500001

"Banana" = 544500002

"Mango" = 544500003 

In the Update a row action below, I added fruit choice Mango and Apple:

Snag_4cdcf4c.png

This the the runtime action:

Snag_4d237d6.png

This is the updated record:

Snag_4e99d66.png

For more information, see (the screens shots may be a bit out of date):

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.

 

Hello @ekarim2020 

I tried it and it worked some how.

but the issue in here is the value needs to be read from the Microsoft forms. When a form is filled it should read the response and create a record in contacts. If I put the integer values dynamically in the response action, it’s directly giving all the options available on the field I only need the options the I select

 

hope you got my point

You can use the same approach to update the record using values from your MS Form. 

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

 

Here is an example based on the linked post:

Snag_a020542.png

You can hard code each of the option set values into a variable of type (JSON) object. The text in the JSON object must match EXACTLY what you have in used in your MS Form for the options:

 

{
  "Green Apple": 544500000,
  "Blush Pear": 544500001,
  "Baby Banana": 544500002,
  "Honey Dew Mango": 544500003
}

 

 

ekarim2020_0-1656844538347.png

 

The Select actions takes the question "Choose one or more fruits" as its input (From). The From field uses an expression which converts the "Choose one or more fruits" response from MS Forms (which is a string!) into an array of JSON objects. You will need to wrap your question within the json action:

Snag_9ef4b7f.png

 

This is the expression for the Map:  variables('varChoices')?[item()]. This expression takes a Choice text (e.g. Blush Pear") , and returns the option set value.  For example variables('varChoices')?['Blush Pear'] would return 544500002. 
 
The Select action produces an array which we can use in Join action.

Snag_a03f99f.png 
The Join action returns all the items from the array as a string separated by the comma character.
 

Snag_9eff3d4.png

ekarim2020_2-1656845657323.png

Finally, we can update the field usng the output from Join action

Snag_9f294fc.png

ekarim2020_3-1656845884955.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.

Hello @ekarim2020 

Tried what u said and it still shows the error “ not valid integers”.

 

I used Initialize variables then next select and later Join action. In join action the output is showing as value instead of text but when I update the join output in the required mapped field is shows the same error not valid integers.

CB0E8702-DBE2-4B97-A4E5-2B2A8C824E7C.jpeg

Apologies @ekarim2020 

 

I haven’t used “Switch map to text mode” step in the Select action, So it throwed me the error. Now it’s working fine

 

 

Thanks a lot and what can I say for your help. Man you saved my time and life, I was struggling on this from few days. Thanks a lot again and again

Hi @Sk365 ,

 

Can you share screenshots of your flow, including the details in variable, select and join actions.

You can capture the screens using:  Use Snipping Tool to capture screenshots (microsoft.com)

or you can use Edge's built in screen capture:

ekarim2020_1-1656850750780.png

Ellis

 

 

Hi @ekarim2020 

 

Actually we are not authorised to use any other browser or mail or site in the company provided laptop, So as why I’m using the snapshot via mobile.

here is the SS of my flow which u asked for

Thanks a lot….

8F92BE01-1683-4B38-AB04-877FCBF9C28A.jpeg

Glad it's now working!

 


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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,580)