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 / Delete and Edit of row...
Power Apps
Answered

Delete and Edit of rows in an existing list item creates a new SharePoint List Item

(0) ShareShare
ReportReport
Posted on by 480

Hi Team,

My Powerapps form linked to SharePoint List looks like below.

When I edit or delete the rows in my Form, a new SharePoint List item is created.

Please help me so that the edits happen on the same list item, instead of creating a new list item.

 

cyberco01_0-1634538047915.png

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,340 Most Valuable Professional on at

    HI @cyberco01 ,

    You might share some code here (in Text) for the deletion as what you are describing should not happen if your process is correct.

  • cyberco01 Profile Picture
    480 on at

    @WarrenBelz , Thanks for the response sir.

    For delete, I follow the following process.

    - Open the list item

    - Click on Edit Item

    - Remove the rows using the small "x" icon

    - Click the default Save button on the top.

     

    Code on the "on select" of the small x icon:

    *******************************************

    RemoveIf(
    InvoiceCollection,
    lblSrNo = ThisItem.lblSrNo
    )

    Code on the onSave of SharePoint Integration:

    ***************************************************

    Set(
    AllPurchasesString,
    Concat(
    Gallery1.AllItems,
    Concatenate(
    txtSrNo.Text,
    "; ", ComboBox3.Selected.PERSONNELNUMBER,
    "; ",
    txtEmpName.Text,
    "; ",
    txtPosition.Text,
    ";",
    txtRate.Text,
    ";",
    txtHours.Text,
    ";",
    txtTotal.Text,
    " | "
    )
    )
    );
    Patch(
    BonusRequests,
    Defaults(BonusRequests),
    {
    Title: DataCardValue1.Text,
    ProjNo: ComboBox1.Selected.PROJECTID,
    MonthName:DataCardValue3.Selected,
    RepeatingSection: AllPurchasesString
    }
    );
    Notify(
    "Record Submitted Succesfully!",
    NotificationType.Success
    );
    Refresh(BonusRequests);
    RequestHide()

     

    Code on the OnEdit of the SharePoint Integration:

    *****************************************************

    Refresh(BonusRequests);
    EditForm(SharePointForm1);
    Set (RepSecCOllString, LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID, RepeatingSection));Clear (InvoiceCollection);
    Set (EditRepSecStr,LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID , RepeatingSection));Set(EditRepSecStr,Left(EditRepSecStr,Len(EditRepSecStr) - 1));
    ForAll (
    Split (
    EditRepSecStr,
    "|"
    ),
    Collect (
    InvoiceCollection,
    {
    lblSrNo: Text (Last (FirstN(Split(Result,";").Result,1).Result).Result),
    txtEmpNo: Text (Last (FirstN(Split(Result,";").Result,2).Result).Result),
    txtEmpName: Text (Last (FirstN(Split(Result,";").Result,3).Result).Result),
    txtPosition: Text (Last (FirstN(Split(Result,";").Result,4).Result).Result),
    txtRate: Text (Last (FirstN(Split(Result,";").Result,5).Result).Result),
    txtHours: Text (Last (FirstN(Split(Result,";").Result,6).Result).Result),
    txtTotal: Text (Last (FirstN(Split(Result,";").Result,7).Result).Result)
    }
    )
    )

     

     

  • WarrenBelz Profile Picture
    156,340 Most Valuable Professional on at

    @cyberco01 ,

    Can we just keep this to the delete code please - are you saying this is all that you have to delete a record - I assume this code runs on the small X icon?

    RemoveIf(
     InvoiceCollection,
     lblSrNo = ThisItem.lblSrNo
    )

    Assuming lblSrNo is a unique identifier, this code should only delete the record involved.

    Your OnSave code however certainly will create a new item - are you saving after deleting - you do not need to.

     

    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.

  • cyberco01 Profile Picture
    480 on at

    @WarrenBelz You are correct, the OnSave is the one creating a new List Item.

    Is there a way I can say in the OnSave code that if the List item is in Edit mode, i just need to update and not create a new list item?

  • Verified answer
    WarrenBelz Profile Picture
    156,340 Most Valuable Professional on at

    Hi @cyberco01 ,

    As long as the record is the one you have selected from SharePoint, instead of

    Patch(
     BonusRequests,
     Defaults(BonusRequests),
     . . . . .

    use this

    Patch(
     BonusRequests,
     {ID:SharePointIntegration.SelectedListItemID},
     . . . . .

     

    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.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard