web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Related Table (Lookup)...
Power Automate
Unanswered

Related Table (Lookup) - Delete Items

(0) ShareShare
ReportReport
Posted on by 288

OK, I have a Table that is related to another table...in the screen shot below you will see there is an Applications_Table

That table is related to another table called "Downstream Applications".  If the user removes ALL the downstream applications from the table (related to the Application selected)...I need to replace "No Data Avaiable" with a Default Application "NONE"

 

Snag_1742c7d.png

 

The issue the downstream application table will still have plenty of records from other applications...I need to know if the ONE related applicaiton selected, now doesn't have any more relationships associated with it.  But when the delete triggers the flow...there isn't enough information to query the table to see if the related application it was deleted from still has records or not.

Snag_177d67a.png

Let me try to simpliy if the Application "Charge Off Macro" has NO assoicated downstream applications because they were all removed...how do I know that to replace it with "NONE"?

 

Thanks,
Mark

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,928 Super User 2025 Season 2 on at

    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

  • smithmrk Profile Picture
    288 on at

    OK, YES this is very confusing to explain...

    Let's use Table "A" as an example in my screen shot as "Red" circle (Applications_Table)

    The Purple circle lets call that Table "B" (Downsteam Applications).

     

    Table "A" has a subgrid of Table "B"...showing ONLY related records in that subgrid.

    Now, if an item is deleted from the Subgrid Table "B"...what I'm tring to figure out is that it was related to Table "A".

     

    When the flow runs, I did add a Compose as you suggested in Step 1...but it only shows me the GUID of the item it deleted from Table "B"...I need to know that GUID item deleted from Table "B" was related to Table "A".

    How can I determine from the Flow that the item deleted was related to Table "A"?

     

    There is no information from the Flow / Delete results that I can use to determine it was related to Table "A"

    Snag_4c7e36.png

  • Michael E. Gernaey Profile Picture
    53,928 Super User 2025 Season 2 on at

    Hi,

     

    I get what you asked for and my solution does exactly that. I explain exactly how mine works. Just putting in a compose does not do that. 

     

    Please re-read Steps 3 and Step 4 as they do what you asked.

     

    But the only way to do that is to get the current Deleted Records Related Records GUID

    Use that Related Record guid to query Table B, filtered ON that guid to get any rows that might be associated to Table A.

     

    As you loop through you are verifying if there are any LEFT after this deleted record, which is what you asked for.

     

    Think about it like this

    1. Delete Row, triggers Flow

    2. Grab the Related Records GUID, which points to table A

    3. Query all the records in Table B, that ALSO HAVE that GUID as their Parent

    4. Loop through them, comparing the GUID from the soon to be deleted record. If none of them match that current records GUID (Table B), then you need to exit the Flow because you know you still have records left. 

     

    And your ask was to know when there are no more related records..

     

    Please re-read carefully my solution.


    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

  • smithmrk Profile Picture
    288 on at

    OK, I guess I'm not following...from my Step 1...I provided the screen shot of the Compose which is the resutls from the Trigger Delete.

    You wrote...2. Grab the Related Records GUID, which points to table A

    My question is from that Compose screen shot where do I get the "Related Records GUID" from?

  • Michael E. Gernaey Profile Picture
    53,928 Super User 2025 Season 2 on at

    It says right there

     

    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

     

    How would I know what you called it? I'm good, not that good. Its your schema, how do you not know your own schema?


    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

  • smithmrk Profile Picture
    288 on at

    Sorry I got busy with something else...I put together a diagram of what I'm trying to accomplish, and I'm not sure if your steps relate to my reqirement.  Because you are not making any sense to me and I would love some sample code to put in the Compose action...because you wrote:

     

    "In the Compose action, you need to grab the Value of the related(Parent) A record"

    But I don't know how to do this??

     

    Here is the digram of my requriment...

    Snag_3b689e.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 378 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 273 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 135 Most Valuable Professional

Last 30 days Overall leaderboard