I have a flow that I can’t get to cooperate. I have only been building flows for a few weeks. This is only my 4^th^ flow.
Here’s what I’m trying to do:
I have a list (Tasks) used to sync with Project. Tasks has the following columns:

Each Tasks list (Task List content type) has 2,000 to 5,000 items. Users report completion against about 60% of the items, but we would like to complete the rest of the items automatically based on completion of dependent items. The items users report directly
against are denoted by “Yes” in the “WR Flag” column. The items not reported against have “No” in that column.
When an item in the table is updated, the flow is triggered and does the following:
(1) Set some variables for later processing

(2) Check to see if the modified item is now complete

a. If Yes,
i. Get items filtered by
1. NWR Flag is “No”
2. % Complete < 1
3. The modified item is a predecessor

Expression: and(less(body('Get_Tasks_items')?['PercentComplete'],1),equals(body('Get_Tasks_items')?['WR_x0020_Flag'],'0'),contains(body('Get_Tasks_items')?['Predecessors'],triggerBody()?['ID']))
· NOTE: I tried to filter in the same get items statement, but got an error saying that the ‘get items’ couldn’t refer to itself
· I am also worried that even if I get this to work, the contains statement will bring back erroneous results (e.g. when modified item is ID ‘1’, it will return records where the predecessor ID is ‘16’ or ‘3416’, etc.)
ii.
Update some variables for use in updating items(s)

Input % complete expression: items(Apply_to_each')?['PercentComplete']
# Predecessors expression: length(body('Get_Non-Complete_Tasks_items')?['Predecessors'])
**Output % complete expression:**add(variables('Input percent Complete'),div(1,variables('# of Predecessors')))
· My worry is that % complete won’t be calculated correctly if an item is modified again after it is already complete since I have no way of triggering the flow selectively and don’t know how to set a condition to check
if the modification to the item is marking it complete for the first time.
- I thought about creating another array column to hold the ‘ID’ of the completed predecessors and then updating it with the current modified ID so I can include it in the condition, but I’m not sure if that will work.
iii. Update item(s)

ID expression: items(Apply_to_each')?['ID']
**Task Name expression:**items(Apply_to_each')?['Title']
b. If No, stop processing.
My error is in the Apply to each 2 Step

Any help on this is greatly appreciated!
[PII is masked by Dihao Guo MSFT Support]