cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ZachRoberts
Level 8

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

@DanFFSLA 

 

Hi! 

It looks like you are running into the issue I did when following the instructions for this flow where each email would receive an email for every task. On the first page in this thread my posts layout the issue and then i have one going over my complete setup in flow, have you tried the settings from those?

 

 

Thanks,
Zach

DanFFSLA
Level: Powered On

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

I read it and it sounded to me like you were getting an email for each item. My emails contain a list of multiple items (as intended) but emails themselves are being send multiple times. So if I have two items on the list, I will receive two emails that each contain both items.  Do you think your solution would work for my issue too?

dmistry
Level 8

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

@DanFFSLA  you are not using DistinctEmailArray and compose needs to be removed, See my screenshots below:

 

1. Initialize variable called 'DistinctEmailArrray' of type array. In the value, use following: 

union(variables('AssignedToEmailArray'),variables('AssignedToEmailArray'))
 
Also change the formula inside Do until to "@empty(variables('DistinctEmailArray'))"

First.JPG

2. Inside your filter array action , change existing expression on the right side of equal to to "

first(variables('DistinctEmailArray'))

"

3. Send an email action: Change TO formula to 

first(variables('DistinctEmailArray'))
 
4. Last two actions need to be updated, Compose and Set variable. In the compose action after send an email, use following: 
skip(variables('DistinctEmailArray'),1)
 
For set variable change variable to set to DistinctEmailArray, make sure the value is set to 'Output' from above compose step.
 
Your flow should work then.
ZachRoberts
Level 8

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

@DanFFSLA yes I was getting an multiple emails for each item which would contain all of the items (it would just iterate through the number of items) but in my next response I solved what the issue is with the orginal post. Please see my two replies.

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/microsoft-flow-get-all-items-with-distin...

(Link above doesn't jump to message but it is message 13 in this thread)

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/microsoft-flow-get-all-items-with-distin...

 

Also it looks like @dmistry is pointing out the issue that would of been found in my post as well Smiley Happy

 

DanFFSLA
Level: Powered On

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

Thank you, Thank you! I was ready to give up on this flow and you guys gave invaluable help.

 

@dmistry - Thank you much! It all worked as you predicted!

@ZachRoberts  - Thank you for taking the time to provide your advice. Since I read dmistry's comment first, I followed his steps.

dmistry
Level 8

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

@DanFFSLA  I was in the same position as yours, lol. I have been in situations where I would have given up on many flows that I had started working on but the flow community is always there to help us so never lost hope and thanks to Microsoft for setting up a platform like this. Many thanks to @ZachRoberts  for his work on the revised solution. Cheers, good to hear that it helped you @DanFFSLA.

ZachRoberts
Level 8

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

Awesome! Glad it worked for you! @DanFFSLA 

 

@dmistry thanks! 

 

I agree this community is very helpful and Flow/Powerapps would of been challenging without this platform to reach out for help! 

 

Best of luck to both of you!

JyoBhai
Level: Power Up

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

Hi All,

 

It worked for me,only need to add 

a set variable AssignedToEmailArray form first compose Output.

 

dmistry
Level 8

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

@ZachRoberts need your help on one of the questions I posted, please answer if u know the solution: https://powerusers.microsoft.com/t5/Building-Flows/Need-help-on-the-flow-expression-for-due-date/m-p...
Highlighted
wi11iamr
Level: Powered On

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

Thanks @dmistry, after much struggling, the solution was merely to modify my Sharepoint List such that my Person/Group field allowed multiple values.

ZachRoberts
Level 8

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

Hi Everyone,

 

Since it looked like alot of people are stumbling across this forum post I did a write up on how to set this up and to get it to work on my website check it out if you would like.

 

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

 

Thanks,
Zach

BB9
Level: Powered On

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

Hello,

 

I tried all the above options but could not fix the below error:

 

Unable to process template language expressions for action 'Apply_to_each' at line '1' and column '2032': 'The template language function 'first' expects its parameter be an array or a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#first for usage details.'.

 

Any other options:

 

@ZachRoberts@gautmish  Thank you!

dmistry
Level 8

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

@BB9, please share screenshot of flow
ZachRoberts
Level 8

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

Hi @BB9 ,

 

As @dmistry mentioned can you please share some screenshots so we can help you out better? 

 

From the error message you are getting your flow is expecting to receive a string or array but it is getting a null value? Is the column you are getting from SharePoint empty? 

 

Thanks,

Zach 

BB9
Level: Powered On

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

Thank you.

 

Attached are the screenshots. The Sharepoint list has four columns and every column has data. Let me know if you need any additional information.

 

Flow1.pngFlow2.png

ZachRoberts
Level 8

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

Thanks for the info. 

 

Now I am just assuming here but is the screenshot of your list with the test data in it the one you are using or was setup as an example? My question here is are you using the 'People' column for your "Assigned To" field?

 

My Assigned To field is setup as below

 

Le761etYVy.png

BB9
Level: Powered On

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

@ZachRoberts Thanks for the response. Yes, that is correct. I am getting the error with the same data. The 'AssignedTo' column has the same properties as yours. Also, all the other columns are removed from the list except these four which we see in my screenshot.

ZachRoberts
Level 8

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

@BB9 Can you send screen shots of the errors you get when you are testing your flow? It might be helpful to see at what step your flow is breaking, can you also expand the other formulas you have entered in your flow?

 

Thanks,
Zach

BB9
Level: Powered On

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

@ZachRoberts  Here it is.

Flow Error.png1.png2.pngfirst(item()?['AssignedTo'])?['Email'] iseual to first(variables('BBEmailArray'))3.png4.png

ZachRoberts
Level 8

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

Hi @BB9 

 

I think i see the issue. on your first apply you need to gather the email addresses and add them to your array like the below screenshot from my flow. v4WTQDLTyJ.png

 

In your screenshot below you are missing this step. So you need to add append to array variable and make sure the apply to each output is set to the value you get from the get items.

 

nPOTtrdlER.png

 

Thanks,
Zach

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 94 members 4,182 guests
Please welcome our newest community members: