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 / Remove patched collect...
Power Apps
Unanswered

Remove patched collection item saved to SharePoint

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

Hello,

 

I have just finished reviewing the video "PowerApps Repeating Tables Like InfoPath Part 3 - Inline editing" by @ShaneYoung 

and whilst I've managed to get the functions working that are required for my app, when I delete an item in my collection gallery, the SharePoint list item it originally created is not deleted.

 

Once a form item is completed in my app, the user then selects a 'Create PDF' button, which via Power Automate, grabs the main list itemID and associated items in the collection list and merges this into a word document, before creating PDF.

 

We don't want deleted collection items that still remain in the SharePoint list to populate the word document.


The OnSelect property of my main EditForm save button is set to:

SubmitForm(SelectedItem_form);
Set(varFormMode,"Saved");
If(varNewItem = true, Navigate(HomeScreen,ScreenTransition.Fade); Set(varNewItem,false));

The OnSuccess of my SelectedItem_form (editForm) control is set to:

(ForAll(colDocData, If(!IsBlank(Argument & Evidence), Patch(colDocDataSP, Defaults(colDocDataSP), {spSubtopic: Subtopic, spSubtopicBreakdown: SubtopicBreakdown, spArgument: Argument, spEvidence: Evidence, DocumentDataID: SelectedItem_form.LastSubmit.ID}))))

The OnSelect of my collection Save icon is set to:

Update(colDocData, ThisItem, {Subtopic: Subtopic_dd.Selected.Value, SubtopicBreakdown: SubtopicBreakdown_dd.Selected.Value, Argument: Argument_input.Text, Evidence: Evidence_input.Text, ShowSaveButtons: false}); If(EditPressed, false, Collect(colDocData, {ShowSaveButtons: true}));UpdateContext({EditPressed: false});
Set(NeedsSave, false)

and the OnSelect of my Delete icon is set to:

Remove(colDocData,ThisItem);Set(NeedsSave, false)

 

I need to do something with the Delete icon so that it not only deletes the collection line/record in the app but also deletes the item it originally created in the colDocDataSP SharePoint list.

 

Any pointers would be appreciated!

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    You need a second Remove() in in the OnSelect of your delete icon that comes before the one that removes the item from the collection. It will have a LookUp() in it to reference the correct item:

    Remove(mySPList, LookUp(mySPList, commonColumn = ThisItem.commonColumn)); // replace mySPList and commonColumns with appropriate ones for your data source
    Remove(colDocData,ThisItem);
    Set(NeedsSave, false);
    

    Hope that helps,

    Bryan

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard