Hi,
I am not sure I totally understand so let me try to translate for me 🙂
Going to restate if thats ok:
Now when people are deleting from Table B, each time you want to see if (after deleting the row from Table B, that is happening due to the flow run in realtime), Table A, has any more "related Table B records" and if not then you want to update Table A (row) that used to be related to the "current Table B record in this flow run"
Is that correct?
If am going to assume its accurate and give you an answer.
Step 1. in your flow, right after the trigger add a Compose action. In the Compose action, you need to grab the Value of the related(Parent) A record from whatever column you are using for the relationship. This will give you a GUID
Step 2. Add another Compose, to grab the GUID of the Row being deleted (the flow run run)
Let me summarize what the below does.
a) it lists all the Rows in Table B, that are still associated to Table A, after THIS row is deleted. And if its Zero, then it updates Table A
Step 3. Now that you have those. Add a List Rows (dataverse action)
3a. For the table, choose Table B
3b. For Select columns you can just put name(or whatever here), AndAddTheGUIDFieldForTheRowId
3c. Now in your Filter you are going to filter on the guid you got in Step 1.
now I have no idea what your relationship column name is IN Table B (to Table A), but you gotta find it.
Then type where everything between the first _ and the _value needs to be changed to your child (TableB) relationship to TableA name...
_tableb_relationship_to_tablea_column_name_value
the _ at the start and _value at the end is REQURIED because its a lookup field and you want to know if any other Table B rows, are also related to table a
Step 4. Do an Apply to each, with the Input being the output of Step 3
-As you loop in the Apply to Each, you would add a condition. The condition would say essentially does the current Child Row GUID equal the GUID for the Table B record you saved in Compose 2.
If any DO NOT =, that means you still have associated Rows to Table A and dont update Table A, so in the No branch, just put a Terminate (action) and leave the flow.
If you never hit the NO branch, then you know (once you leave the Apply to each) that there are no more records associated and you should do the Update to Table A, AFTER the Apply to each of the Child rows.
and done.
Truly it may sound harder than it is, just follow this and build it and come back if you have questions.
Cheers
If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey