Hello, I am attempting to make a timesheet canvas app connected to Dataverse. I am using the code below to update existing records. It seems to work fine when adding a new line and saving initially. After I press make an update and save again, it simply saves the data in the second record to the first record and clears out the original data in the first record.
ForAll(
Filter(
colUpdateTimesheetLines As Timesheet,
!IsBlank(Timesheet.TimesheetID) // Identify existing records
),
With(
{
ExistingRecord: LookUp('DEV-TIMESHEETS', cr359_timesheetid = TimesheetID)
},
Patch(
'DEV-TIMESHEETS',
ExistingRecord,
{
Owner: CurrentUser,
Sun: Sun,
Mon: Mon,
Tues: Tues,
Weds: Weds,
Thurs: Thurs,
Fri: Fri,
Sat: Sat,
'Hours Worked': Total
}
);
Notify("Existing record updated with TimesheetID: " & TimesheetID, NotificationType.Information)
)
);
First Save:
After saving again:
Collection shows original:
Any help will be appreciated! Thank you