“I’d like to copy a multiple choice SP field to another item, what’s the best way to select only the values from the array with Power Automate?”
“I need to extract only the user email addresses, I don’t need all the other user information.”
Working with Power Automate often involves working with arrays. Sometimes it’s a simple array, but more often it’s an array of objects. And with arrays of objects there’s a difference between what you get and what you can use. For example the SharePoint multiple choice column. You’ll get 3 properties for each of the choices, but you’ll need only the “Value”.
The same applies to multiple people picker. You get all the user information, but in most cases you need only the email address.
How do you then extract only the desired values, ideally in the required format?
Use the ‘Select’ action
The action you’re looking for is ‘Select’. You’ll input an entire array of objects and select what values it should return. The action has even an option to return a simple array with the values, or another array of objects.
Select only values
You can switch the action to return a simple array by pressing the small button – it’ll keep only 2 fields visible. Enter the whole array in the ‘From’ field, and select which value you want to return in the ‘Map’ field.
This is often used in combination with the join(…) expression to turn the values into a string. For example, if you want to send a single email to multiple users at once.
Select values and turn them into array of object
The other option is to return an array of objects. If you keep it in the original mode, with 3 fields, you can input the array, select what values it should return, and define the property key for the value.
This approach is used when you want to copy the values to another place and you need them in a specific format. For example, to update multiple people picker column or a multiple choice column.
Summary
‘Select’ is one of the most powerful actions in Power Automate, it’s the easiest way to get values from an array. Instead of looping through all the objects and appending the values in a variable, you can have a single action. All you need is to find the right format of the array, and ‘Select’ it accordingly.
Hi Tom,
I have been trying this with a multi-select choice field and the output of the Select action is just like yours, except for with my column “Building” and the building values. I then need to send an email with the building values listed in the body. I can’t figure out how to get just the values. I’ve created a Join action after the Select action, but the email body looks like this:
{“Value”:”Building 1″},{“Value”:”Building 4″},{“Value”:”Building 7″}
How do I remove all the “value” text and characters and just get Building 1; Building 4; Building 7
Thanks,
Beth
Hello Beth,
you should switch the ‘Select’ action to the text input only mode, without the Key value as shown on the screenshot.
Thank you for this post! It has helped me immensely!
Hi Tom, This helped me a lot, but I need to extract one item from an array (department column) that matches the department field in a single item on another list.
Source list: Department (single line of text, unique values only)
Contact (value changes)
Example: Department = Finance
Contact = John Smith
Destination: Department, Assignee, Manager, Contact
Example: Department = Finance (manually chosen from lookup)
Contact =
Objective: Src Department value = Dest Department value then update Dest with current Contact and item ID
The reason I have to do this through automate and not lookups is that this is part of a complicated time tracking process and this information will be sent to multiple lists that fulfill different objectives.
Using your steps to Select from the array, I was able to get a list of departments. However, I need to compare Source to Destination in order to update the Destination list with the Department’s current contact.
Let me know if this is an overreach! I’ve been struggling with this issue for about 3 months and I haven’t found a solution.
Thank you!
Hello Fran,
from the description I’d think that you need a lookup to find the value in the other list as described here: https://tomriha.com/how-to-lookup-data-in-another-sharepoint-list-in-power-automate/. ‘Get items’ with a Filter Query to find the corresponding department and then use the returned item to update the Contact information.
Hi Tom
This seems to be exactly what i need but i’m getting stuck with automate creating extra for each loops.
I am taking one SharePoint list and copying entries into another. Because any field that includes multiple values e.g. tags and people come out as an array of objects with lots of parts but can only be entered as an array of single values e.g. email addresses for people i need to strip them down. So within a for each stepping through each item in the list I need to pre-format those date types.
However, I’m getting unstuck with the select action. I think i’m selecting the right dynamic content for the array (for the specific list item) for the ‘from’ input but i don’t seem to be able to create the map. Whenever i select anything that refers to the part of the object i need (e.g. the email address) automate then wraps the select action into an extra for each loop and (it’s not giving me just the options for items within the array selected in the from box).
Any idea where im going wrong?
Hello Ian,
I’d check if you’re using outputs from the same action in the ‘From’ field and then in the ‘Map’ fields while adding the ‘From’ first and the ‘Map’ later. I can imagine it’d add loop if the dynamic contents came from different actions.
Hello Tom,
this is almost exactly what I’m looking for, thank you!
We run a daily flow where we select multiple items that contain the value “Receipt” but can also contain other values.
After sending a mail containing item information, we want to remove only the value “Receipt” from these items but want to keep the other values.
Do you know a way how we can do this?
Hello Nico,
you can add another select where you’ll remap all the other values to their properties, but skip the “Receipt”.
Great info Tom! This has gotten me so much closer to what I am trying to achieve. I’m only left now with how to select a single matching value for a specific key. My data looks like this:
body {
“odatatag”: “some string”,
“value”: [
{
“object name”: “name 1”,
“object property”: “property 1”
},
{
“object name”: “name 2”,
“object property”: “property 2”
}
With this data I’m trying to get the object name where “object property” equals “property 2”.
In my scenario I won’t know the number of objects in the array beforehand so using index doesn’t really help. I also don’t know if any of the objects will have a matching property. But if any of them have property 2 I know it will only be one of them. This means no need for looping or apply to each. Any idea how to accomplish this with simple select or expression?
I’ve tried outputs(‘array_of_objects’)?[body/value]?[‘object property’]?[‘property 2’] but I only get error message that object property cannot be selected, only index can be selected for array. TIA
Hello Kevin,
use the ‘Filter array’ action first where you enter the ‘value’ as the input and search for objects where ‘object property’ is equal to ‘property 2’. Using the output in the ‘Select’ action will give you the desired value from that object.
Hi Team,
By doing HTTP Call i got the 0365 Usage mailbox details of all the users in JSON format. But i only want to select the 15 users from that list. Can you please suggest how can we filter only about 15 mailbox details from a list of array objects.
Hello Hakeem,
if it’s an array you can use a composed filter in the ‘Filter array’ action, in your case it might be or(…) with 15 different equals(…) expressions: https://tomriha.com/how-to-apply-multiple-conditions-in-the-filter-array-power-automate-action/
Hi Tom, This is awesome. Just signed up for your newsletter.
I’m very, very new to Power Automate. This may be a ridiculous question, but I’ve not been able to find a solution. With your thorough and easy-to-understand posts, I’m hoping you can help.
I’ve set up an “Update when item is created or modified” flow to copy several columns from SP List A to List B; however, when the List A Person column features multiple users/values, the flow creates a separate item on List B for each user that Person column is set to Inputs for Array Item. When I switch it to “Input Entire Array”, nothing transfers over.
Any guidance you can offer is greatly appreciated.
Hello Christy,
take a look on this article that explains how to copy multiple people picker columns: https://tomriha.com/how-to-update-multiple-people-or-group-column-in-power-automate/
this is very helpful
Thank you
Hi Tom, thanks for posting this it’s really well explained.
I’ve been able able to follow along (starting from the output of a SharePoint Get Files (properties only) and use a compose action to successfully return the the file Identifier of the first item in the array. However, when I then try to use the Identifier in a SharePoint Move File action I get an error telling me that the response is not in JSON format. The problem does seem to be the File Identifier, as I also tested it with a simple Get File Content step, and that also errored. I’m wondering if perhaps the format of the value that I created in the compose step is not quite right? Any thoughts would be much appreciated.
Hello Mel,
I’d add a ‘Compose’ action to check the extracted value – just add ‘Compose’ and put the expression inside, you’ll see in the flow run history what you got. At the same time, try to manually select some file to move and check that action in the run history too – you’ll see 1. what you enter in the Move file and 2. if it has the same format as the manually selected file. With files there can be an issue as some actions ask for file ID (number) and some for file identifier (path to the file).
Hi Tom, I really appreciate all you do for everyone. I’m a little stuck and have been looking at some of your posts like this and your other one.
https://tomriha.com/how-to-update-multiple-people-or-group-column-in-power-automate/
I have a recurring flow for a SharePoint document library, where I want to extract the reviewer if the status is “Published” and the review date is today.
The reviewer email address is what I want for each file. When I try the select action, I get this error: he execution of template action ‘Apply_to_each_4’ failed: the result of the evaluation of ‘foreach’ expression ‘@items(‘Apply_to_each_2′)’ is of type ‘Object’. The result must be a valid array.