Question

How to update using patch in SharePoint list from edit form?

Using below patch function. but, its creating new record every time.

When I select an item from the gallery and edit it, creates a new item what's the problem?

Patch Code:

If(DataCardValue1.Selected.Value = "Time Off",
Patch(
   LeaveRequests,
   Defaults(LeaveRequests),
   {
   LeaveID: CurrentUserID,    
   User:     DataCardValue6.Text,
   UserEmail:
   {
 Claims: Concatenate(
          "i:0#.f|membership|",
          DataCardValue3.Selected.Email // Person email
          ),
          Department: "",
          DisplayName: "",
          Email: User().Email, // Person email
          JobTitle: "",
          Picture: ""

   },

   Description: DataCardValue2.Text,
   TimeOffDate: DataCardValue22.SelectedDate,
   TimeOffFrom: DataCardValue19.Selected,
   TimeOffTo: DataCardValue20.Selected,
   TotalTimeRequested: Label23.Text
   
    }
  )
); Navigate(SucessScreen,None)
Was it helpful?

Solution

Use patch as below. You are proabably using Defaults() as second parameter to your patch function.

Patch(DataSource, {ID:selectedGalleryItem.ID},{Title:'UpdatedValue'});
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top