I am currently trying to combine multiple site workflows into one. We have a list of activities scheduled for the next 45 days. We have workflows that query the list, pull out specific pertinent info, then send an email to the necessary parties. We have 1 workflow that pulls all activity and sends to a manager, and then individual workflows that pull only an assigned user's activity, and then emails that to them. I am trying to simplify this since we currently have 15 workflows.
I have run into several issues, and I cannot seem to find a structure that will accommodate this. I have tried running 1 query (with for each, and email string built) then a parallel branch run if for each user. This will return inconsistent results, sometimes I will get one correct email, but then the workflow will terminate the rest saying the index property is greater than the items in the collection, or it will send an email for each user, but it will have items that are assigned to other users, or every item in the list.
I tried a parallel branch of the same query with each just having an additional condition to only pull items assigned to a specific person, but the emails from that do not pull the correct user's activities either, and sometimes duplicates it. I also tried concurrent queries, same result.
I am not sure how to best structure this, but what I am doing is clearly not working, so I would appreciate input. Attached is the latest example, although the query-> For Each-> Get Item -> Calculation portion is the same across the board.