cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mousman85
Helper IV
Helper IV

Multi select/choices field populated via power automate

Hi All,

 

I've been looking for a solution for this issue and can't seem to find one. I'm using power automate to create a new record in my dataverse when a Form submission is received. Part of the form is a multiselect box where the user can choose the areas the supplier will work with. I need this to then populate the Multiselect/Choices field my dataverse table to use within a model driven app. 

 

I know that choice fields use a value when assigning using Power Automate. But I can't figure out how to reference each field get the correct value and then add that to a string that will then created the record. Is there a way to reference the choices column list out all the choices match them and then get the values? I've tried building it in Power Automate and creating an array with all the choices and values but when it tries to select it just returns all values in the array. 

 

Is there a better way to do this? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mousman85,

 

You can skip the apply to each and append step. You instead can just assign the variable using the Join expression as mentioned.

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

11 REPLIES 11
ChrisPiasecki
Super User
Super User

Hi @mousman85,

 

You can retrieve the labels/values for a Choices field by querying the StringMap table. This video goes through a step by step of how you can accomplish this. In your case you have the label and want to get the value, which is the opposite in the video so you'll have to slightly tweak your FetchXml query but the overall approach should be similar. You can join the array output of the query into a comma separated string which can be passed into your Choices column when creating your Dataverse record.

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

 

Thanks for the reply Chris. That video was super useful. I acutaly worked a different way to at least get the values. I'm using the List Rows connector in Power Automate on the String Maps table, and have applied an ODATA filter to filter it for the attributename to eq my choices field, and then I've added a second filter that filters the values by the Type i want to match. This is now returning the values correctly the only but I can't figure out is how to then append each value in a comma spaced string so 00001, 00002, 00003, etc I've tried adding an append to string at the end of the apply to each section using Current Item, but this just set the variable each time to a single result. image.pngimage.png

ChrisPiasecki
Super User
Super User

Hi @mousman85,

 

You can use the Join expression to turn the array into a comma separated string.

e.g. join([<multiselectoutput>], ',')

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

Thanks does this work on an append to string? The issue I was seeing is that each apply to each is only returning a single value, so I need to take that value store it or keep appending each returned value to create a string. 

Hi @mousman85,

 

You can skip the apply to each and append step. You instead can just assign the variable using the Join expression as mentioned.

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

I don't think this will work as I don't have an array, the List rows action, is returning individual values that match the filters so if it matches the Option - Project Manager it returns a single value of 0000001, I need to join these matched values together to form a string of each returned matched value. Which could be 0000001 , 00000012 , 0000003 etc. I can get each value returned individually but can't work out how to then keep adding to the first value found. 

mousman85
Helper IV
Helper IV

I managed to solve this in the end I didn't realise that you needed to get the append to array variable output after you've done all the appends,  Thanks @ChrisPiasecki for your replies it guided me into the right place!

 

 

takolota
Super User
Super User

@mousman85 & @ChrisPiasecki 

This is all for entering values into a multi-select field for a Dataverse Update action?

 

I have to enter possible multiple choice meal time options in to my Dataverse table and I just use the following expression to create my string of numbers matching the choices:

replace(trim(concat(if(contains(triggerOutputs()?['body/28 - Service Times Offered'],'Breakfast'),'759090000 ',''), if(contains(triggerOutputs()?['body/28 - Service Times Offered'],'Lunch'),'759090001 ',''), if(contains(triggerOutputs()?['body/28 - Service Times Offered'],'Dinner'),'759090002 ',''))), ' '',')
 
The field is mandatory so I don't have to worry about null values in a replace function, but even if it wasn't mandatory I would just use a if(empty(InsertOutput), '', Replace(InsertOtherFunctions)) to avoid the null values in replace function issues.
 
All the integer values are available if you go to the table, go to edit choices, click the three dots ... and select view more.
find int2.pngFind int1.png
WendyLumsden
Advocate I
Advocate I

@mousman85 , @ChrisPiasecki , @takolota .... another helpful resources was this one:  https://powerusers.microsoft.com/t5/Building-Flows/Power-automate-to-Copy-SharePoint-Multi-Choice-va...
I was battling to convert the strings (created by replace) to integers which Dataverse required and since I had over 10 multichoice fields all the replace() and int()'s got very confusing :).  This was a simpler solution.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (3,284)