Microsoft Flow – The pains of SharePoint’s multi-people fields

Quite a common requirements for Microsoft Flow is to use a multi-people field to create a single event in a calendar. You will probably start by creating a SharePoint list with a people field that can hold multiple people. Then you create a flow that triggers on the creation of an item in this list. Then you add a create event action in the Flow and  you end up with a flow like this:

That’s not nice. Flow has now added a Apply to each step. this then results into multiple events being created.

How do we solve this one?

I’m starting this by initialising 3 variables.

 

Now I’m setting 3 variables :

  • Attendee – is a copy of my email field. Although not really needed it does help when you debug the flow to have this available within the run history output
  • Attendees – The list of attendees that the flow is building up. this will be used for the create event action
  • Previous Attendees – This is a variable to store the values in temporarily as the set variablee doesn’t like to use the same variable to set and to reference within its new  value.

Again an Apply to each will appear, but this time I’m happy with that as I can now concatenate the attendees into a single string. It would be nice to just use 2 variables but it isn’t possible to assign a value to a variable using the value of the variable itself.

The concat function looks like this

concat(variables(‘Previous Attendees’),’;’,items(‘Apply_to_each’)?[‘Email’])
or
concat(variables(‘Previous Attendees’),’;’,variables(‘Attendee’))

Then finally I adjust the required attendees in my event by using by attendees variable and all works as I wanted:

 

 

Advertisements


Categories:Flow, Microsoft Flow, Office 365

Tags: , ,

9 replies

  1. Hi Pieter, I’m curios – why did you create 3 variables ? I updated mine with 1 variable, and eventually solved my issue

    Like

  2. yes it is

    Like

  3. I solved this by doing the following:

    1.) Initialize an array variable called “Notify List Array”
    2.) Initialize a string variable called “Notify List Emails”
    3.) Apply-to-each and use the “Append to array variable” action
    -Name: “Notify List Array”
    -Value: insert dynamic content for your multi people list
    4.) Use a Join Array action:
    – From: Notify List Array
    – Join with a semicolon ;
    5.) Set Variable Notify List Email = Output from the join array action

    Now you can use the variable in a send email action. 🙂

    Like

  4. This is for email field. How would it work if I have multiple people picker selections as display name, I am not able to make it work. I have a people picker column in a task list which allows tagging multiple users, it shows display name.

    Like

Please leave a comment or feedback

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.

%d bloggers like this: