Flow Update Multi-Select Column

When building flows in Power Automate, there’s a trick when it comes to updating a field where you can select multiple items.

This applies to:

  • People-pickers
  • Lookups
  • Choice fields
  • Managed metadata

Especially if the field is required in SharePoint, flow will insist that you populate it with a value, even if that record already has one.  In this post, I’ll show you how to get around this issue, no matter the column type.

In this very simple example, I have a document library full of company policies.  When a file is modified, it goes through an approval process and then the file’s metadata (columns) need to be changed.  The focus in this post isn’t what is happening in the approval process.

The focus is on the update action…

which applies to the Update Item action (for a SharePoint list item) or the Update file properties action (for a file in a library).

My person column is called “Policy Owners”, and I can have multiple owners per policy.  In a flow, the action looks like this:

sharepoint-update-file-properties-action

The tendency, especially when it’s a required field with a red asterisk next to it, is to just add the dynamic content of itself, just put the same value back in this field.  Not so easy with a multi-select.

This is wrong:

sharepoint-dont-update-file-properties-like-this

The problem with the above screenshot, is that it will create a loop.  For each policy owner, it will update the file properties and put that policy owner’s name in the field.  The problem is that, for example if I have 2 policy owners, it edits the item twice, and each person’s name is inserted as the policy owner, two separate times, so that the end result is only one person’s name will still be in the field. EVERYONE ELSE IS REMOVED EXCEPT FOR ONE PERSON

Again, this problem is the same for all of the different types of multi-select fields.  The solution is to create an array variable.

1.  At the beginning of the flow, right after the trigger, add an action:  Initialize variable
flow-initialize-array-variable-people

2.  After initializing the variable, add an action to append to an array variable.
append-to-an-array-variable-people

3.  Now the syntax is needed, for what the array needs to consist of.  This will be different for different kinds of fields.  Go ahead and add your action to update item or update file properties, and type some random word in the field, and click the button Switch to input entire array.
flow-switch-to-input-entire-array

4.  Voila, here is the syntax you’ll need.  THE SQUARE BRACKETS ARE NOT NEEDED.  Copy this content to your clipboard.  You do need the curly brackets, but not the square ones on the outside.
INPUT-ARRAY-CURLY-BRACKETS-FLOW

5.  Scroll back up to your action called Append to array variable.  Paste this in the Value box.
append-claims-array-variable-flow

6.  Now the “xyz” needs to be replaced with your dynamic content.  Delete it, and select your field from the dynamic content panel.  A loop will be created, which is fine.  Notice that the field is called “claims” so the policy owner claims is what I select.  Other types of fields may have something like Id or Value, but a person field has “claims”.  Now, for each policy owner, it will add that person to the array, so then you’ll have one big array with everyone in it.
flow-append-policy-owner-claims-array

7.  In the Update item or Update file properties action, go back to your field, in my case it’s “Policy owners”, and insert the array variable.  Be sure that the toggle is still set to “switch to input entire array” (from step 3).
image

The end result is that the value is correctly placed back into the multi-select field.  And you can use this append to an array concept to add more people to the list of policy owners if you needed to do something fancy like that.

Check out my advanced Power Automate (flow) class, self-paced online!

BONUS:

If you need to send an email to, say, all of the policy owners, you would append to a string variable, not an array, and you would use their email address and a semicolon.  Then that variable could be used in the “To” box of the email.

8 comments

  • If you change to input entire array then insert the dynamic value. This does the same thing doesn’t it? No need to create a separate array to hold the dynamic array unless you need to manipulate the array in some way.

    Like

  • Thanks for the post.this take care of long running issue I needed to fix with multi-choice columns.

    Like

  • Thank you so much for the steps to update a multi select lookup field.
    My lookup field is actually a SharePoint online library lookup onto itself, so that i can create a relationship between documents in the same library.
    The issue is that no matter what ID I used to build the array… the lookup always resolves to null.
    Any assistance and advice would be greatly appreciated.

    I append the array with:
    {
    “Id”: @{body(‘Update_file_properties_-_xxxxx’)?[‘ID’]}
    }

    Input
    I set the lookup with:

    [
    {
    “Id”: 2600
    },
    {
    “Id”: 2599
    },
    {
    “Id”: 2598
    },
    {
    “Id”: 2601
    },
    {
    “Id”: 2602
    }
    ]

    Output

    The lookup is not part of the body
    The lookups value is []

    Like

  • Great info!! Thanks!

    Like

  • Laura,
    Since 2010 when I’ve found myself hitting my head against a wall I’ve learned that there’s a small group of content producers who are actually helpful. With this post, once again, you’ve once again shown yourself to be super helpful. Thank you!!

    Like

  • Laura, I echo @Danny Pantoja. This solved a sticky problem for me, too!

    Like

  • Thank you SOOOOO MUCH! This saved me on a project I was working on. 👍

    Like

Leave a Reply to metadatatest Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.