cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hello, I'm still having issues with the Append to variable step. It expects an Array or string but it comes with an Object.

My only difference is that the AssignedTo field is not set to allow multiple people, just one.

It could be that?

Thanks in advance

Highlighted
Advocate II
Advocate II

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @Steph04 ,

 

Can you please provide the formula you used for the part that is failing in your flow?

 

Thanks,

Zach

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @ZachRoberts  I have added in the DistinctEmailArray to my flow, but I am receiving an error on the Send an Email step. I am using a SharePoint list, not a task list. I am able to get the flow to work using my email as the recipient and I receive the correct number of emails, but when I use the formula to have the emails sent to the emails in the SharePoint list it is resulting in an error. I've attached screenshots of the error screen and the flow in the edit screen and copied the error message below.  Can you please help me resolve this? Thank you. 

 

Error details: One or more recipients are invalid.
clientRequestId: 5126a485-6460-438d-82dd-b0463eb64391
serviceRequestId: 7846e2c7-467a-4585-b147-4d04de94aed4

DRL Test Flow error.JPGDRL Test Flow screen.JPG

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Can you please check the array to verify that it's passing correctly formatted email addresses?
Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

The array is only returning the first letter of each email address. 

array.JPGarray flow.JPG

Highlighted
Advocate II
Advocate II

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @kneppers0 ,

 

Are you using a people column in your SharePoint list? I am using a regular SharePoint list for my flow as well. 

 

It looks like your formula for creating the email array is not correct, it should look like below: 

 

pqL0YqxOye.png

 

I have a write up on my blog that may help you with this flow https://spodev.com/task-reminders-microsoft-flow-and-sharepoint/  

 

Thanks,
Zach

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @ZachRoberts thank you for your help! this worked, I was not using the people column in my list. Appreciate it again! 

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

@fzer0 Did you ever figure out how to extract all values within the 'AssignedTo' column for a task with multiple people assigned?

 

@ZachRoberts @dmistry  Any help would be appreciated on this. I've followed the flow listed within this email thread very closely - using both the 'AssignedToEmailArray' and 'DistinctEmailArray' to send one consolidated email of all tasks assigned to each user. I am just having trouble with cases where multiple users are assigned to a task via the 'AssignedTo' column - the flow is only returning the email of the first user within the column for each record.

 

Really appreciate all the help you both have provided within the thread.

Highlighted
Advocate II
Advocate II

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @DylanBaxter ,

 

You can follow the solution on my blog, please make sure your columns in the SharePoint list are setup correctly.

 

https://spodev.com/task-reminders-microsoft-flow-and-sharepoint/

 

Thanks,
Zach

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @ZachRoberts  - appreciate the prompt response.

 

We may have a misunderstanding. I apologize for any confusion caused on my end.

 

Following your blog post - I have confirmed my columns are set up correctly, my issue is I am attempting to get the flow to work for line items with multiple users in the 'AssignedTo' column.

 

For ex;

 

Task # Column         AssignedTo Column

Task 1                       User 1

Task 2                       User 2

Task 3                       User 1 & User 2

 

In the above, my flow would send 1 email to User 1 with Tasks 1&3, and 1 email to User 2 with Task 2. I am trying to include Task 3 in User 2's email as well, or create a separate email addressed to both user 1 & user 2 for Task 3.  

 

Here's a quick look into my flow -

 

  AssignedTo Flow.JPG

 

Appreciate the help.

Highlighted
Advocate II
Advocate II

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

@DylanBaxter ,

Can you post screenshots of your flow with the formulas showing? The flow should be functioning the way you are describing where a user will get an email for every task they are apart of. 

 

-Edit - sorry didn't see the earlier screenshot but more detailed ones would be easier to troubleshoot.

 

Thanks,

Zach 

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hey @ZachRoberts  - I just updated my previous reply to include a screenshot within the flow.

 

Let me know if you need me to expand any of the actions.

 

Could it have anything to do with the 'Send an Email' command being addressed to first(variables('DistinctEmailArray')) ?

Highlighted
Advocate II
Advocate II

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

@DylanBaxter ,

 

Yes can you please send screenshots with the fields expanded and formulas visible.

 

That should be correct for you To field in the email step, after the email is sent you should then be stepping through your distinct email array to the next address.

 

Thanks,
Zach

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hey @ZachRoberts ,

 

See below:

Flow Pt 1.JPG

Flow pt 2.JPGflow pt 3.JPG

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Hi @ZachRoberts  / rest of thread -

 

Has anyone been able to solve the issue of sending an email to multiple users assigned to the main task? 

 

Took another swing at it over the weekend and haven't been having much luck. 

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Thanks for this post, very helpful to get me going. Quite a challenge tho.

 

It took me a day to get this to work. In the end I changed a bunch of things to simplify the flow and decided to use a serarated SP List that included the users, this allowed me to skip a few steps. Also, I added formulas in the odata Filter queries to make the flow Sorter (In my case, I filtered out the Items that were recently updated.

 

I faced a lot of issues, the 2 main ones were these:

 

1) The first problem for me was this:

first(item()?['AssignedTo'])?['Email']

This only works when the Person column allows multiple users and it took me hours to find out that it can be solved by changing it to this. There's a comment here somewhere with the same conclusion:

item()?['AssignedTo']?['Email']

the "first(" part is not the first object of the array i reckon, but the multiple person column and I just couldn't wrap my head around it.

 

2) The Filter Array didn't work for me.
I tried everything, even tried to the Filter Query from the Get Items operator.
I still don't know why unfortunately, but the formula didn't work until I tried "last(" instead of "first("

@equals(item()?['AssignedTo']?['Email'], last(variables('AssignedToToEmailArray')))

That seemed to do the trick for me, filtering the data was the hard part.

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

ignore this it was the problem with my outlook

Hi,

 

I am having a strange issue with this. I've managed to make it work without having the send email action. But if i add the send email action the workflow runs forever without giving any error message and i have to cancel it.

 

Any help would be appreciated.

 

Thanks

Divya 

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

I was able to get this to work on a SharePoint list that has multiple people assigned to the same task.  This flow will iterate over the list and send a single e-mail, to each person, formatted nicely with links and assigned task only for them.

 

Add your trigger action

 

Get SharePoint Items

Filter Query:

Note: Highly recommend filtering your list at this step as it will speed up the rest of the flow

 

 

Vague_x0020_Flag eq 'Y' or IT_x0020_Assistance_x0020_Flag eq 'Y'​

 

 

 

Capture.JPG

 

Initialize AssignedToEmailArray

 

Apply to EachThis was one of the major changes to get this to work

 

 

@{body('Get_items')?['value']}

 

 

 

Apply to each 2 - This was one of the major changes to get this to work

 

 

@{items('Apply_to_each')?['Assigned_x0020_To']}

 

 

 

Condition 2 - This was one of the major changes to get this to work

 

 

@{items('Apply_to_each')?['Assigned_x0020_To']} ne null

 

 

If yes

Append to array variable - AssignedToEmailArray

 

 

@{items('Apply_to_each_2')?['Email']}

 

 

 

Capture2.JPG

 

Initialize and Set - UniqueEmailArray

 

 

union(variables('AssignedToEmailArray'),variables('AssignedToEmailArray'))

 

 

 

Initialize ArrayCount1

 

Capture3.JPG

 

Do Until (Everything below is within the Do Until loop) 

 

 

@empty(variables('UniqueEmailArray'))

 

 

 

Filter Array 2 

Value

 

 

@body('Get_items')?['value']

 

 

Click Edit In Advanced Mode - This was one of the major changes to get this to work

 

 

@contains(string(toLower(item()?['Assigned_x0020_To#Claims'])), string(toLower(first(variables('UniqueEmailArray')))))

 

 

 

Select 2

From

 

 

@{body('Filter_array_2')}

 

 

Map:

Note: I don't know why but after saving Power Automate will sometimes say this is invalid JSON.  Copying and pasting it back in fixes the error so you can save.

 

 

"<tr><td>@{item()?['Requirement_x0020_ID']}</td><td>@{item()?['Report_x0020_Name']}</td><td>@{item()?['Data_x0020_Field']}</td><td><a href=\"@{item()?['{Link}']}\">Link</a></td><td>@{item()?['Modified']}</td></tr>"

 

 

 

Set variable 2 - ArrayCount1

 

 

length(body('Select_2'))

 

 

 

Join

From

 

 

@{body('Select_2')}

 

 

Join With

 

 

<div></div>

 

 

 

Capture4.JPG

 

Condition

 

 

@variables('ArrayCount1') eq 0

 

 

If no

Get user profile (Under If No)

 

 

@{first(variables('UniqueEmailArray'))}

 

 

Send an email (Under If No)

Note 1: You can modify the columns that are displayed by changing the text between td brackets adding as many columns as needed between tr brackets.

 

Subject

 

 

Email Subject - @{variables('ArrayCount1')}

 

 

 

Body

 

 

<!DOCTYPE html>
<html>
    <head>
<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: center;
  border-collapse: collapse;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 3px 2px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>
    </head>
    <body>
		<p>@{body('Get_user_profile_(V2)')?['displayName']},<br>
		<br>
		You are receiving this email because additional information is needed to complete Report Data Mapping. Please review the fields identified below and provide clarification on definition, use, and meaning in the <u>notes</u> section of the corresponding &nbsp;SharePoint link.</p>
        
		<p><h1>Daily Data Mapping Task Report</h1>
        <table>
            <tr>
                <th>Requirement ID</th>
                <th>Report Name</th>
                <th>Data Field</th>
				<th>SharePoint Link</th>
<th>Modified</th>
            </tr>
@{body('Join')}
		</table>
    </body>
</html>

 

 

 

Capture5.JPG

 

Compose (Outside of If No Condition but in Do Until)

 

 

skip(variables('UniqueEmailArray'),1)

 

 

 

Set variable - UniquieEmailArray (Outside of If No Condition but in Do Until)

 

 

@{outputs('Compose')}

 

 

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

Highlighted
Frequent Visitor

Re: microsoft flow get all items with distinct Assigned to (User and group) filed

I am trying to construct a simple flow that is very identical to the initial solution provided on this thread. I also followed @ZachRoberts post here. Unfortunately, I had no success with multiple tries and still struggling to get through. I am eagerly looking for some help as I find debugging is never easy with Flow ☹️

 

I have attached the snapshot of the Flow, Error message, SPO List. As a first step, I want to ensure the working of flow without the email notification. Any help will be of great help.


@-Garrett-  @ZachRoberts 

 

Error log 1...Error log 1...

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (7,489)