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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I remove the it...
Power Apps
Answered

How do I remove the item in a gallery AND all related items in a secondary list (using a delete icon in a gallery)

(0) ShareShare
ReportReport
Posted on by 282

I have a gallery that I added a 'delete' icon to.

In the OnSelect property, I added code that I expected to delete "ThisItem" from a PARENT list, and also attempts to remove the related items in a CHILD list.

 

The Child list has a column called 'Ref ID' that identifies and links its items to their respective Parent item in the main list.

 

** The code below deletes the Parent item from its list as expected, but it isn't removing the items from the Child list.

RemoveIf(ChildList, 'Ref ID' = ThisItem.ID);
Remove(ParentList, ThisItem)

 

Any assistance is greatly appreciated.

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @rkirk2k are the lists your are refering to SharePoint lists?
    If so, this can be done on List / data source level: (1) go to the LookUp column's settings, (2) more options and use the settings below:

    LaurensM_0-1671226124953.png


    If you want to only use the button, try this adjustment:

    RemoveIf(ChildList, 'Ref ID'.ID = ThisItem.ID);

     

    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    Hi @rkirk2k ,

    You just have them the wrong way around

    RemoveIf(
     ChildList, 
     'Ref ID' = ThisItem.ID
    );
    RemoveIf(
     ParentList, 
     ID = ThisItem.ID
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Verified answer
    rkirk2k Profile Picture
    282 on at

    Thanks for the reply. I figured this out yesterday - I needed to convert ThisItem.ID to text and it worked perfectly.

     

    Also - I wasn't using a lookup column. Not sure where that came from. Again - I appreciate you engaging.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard