I'm working on the leave balance template and I have changed the data source to sharepoint. Everything works as expected except when a leave request is approved, the balance does not update to reflect the change, for example I made a request for vacation and had it approved. It is supposed to update the "vacation used" portion when the request is approved.If i enter it manually from the list the change is reflected on the app.


This is the code used on the approver button
Concurrent(
Set(_submittingRequest, true),
//when approving leave, add the respective days used to the respective used days field
Patch(Balance, LookUp(Balance, BalanceID = _requesterBalanceRecord.BalanceID),
If(Upper(GalleryRequests.Selected.LeaveType) = Upper("Vacation"), {VacationUsed: _requesterBalanceRecord.VacationUsed + _requestedDays},
Upper(GalleryRequests.Selected.LeaveType) = Upper("Sick leave"), {SickUsed: _requesterBalanceRecord.SickUsed + _requestedDays},
Upper(GalleryRequests.Selected.LeaveType) = Upper("Floating holiday"), {PersonalUsed: _requesterBalanceRecord.PersonalUsed + _requestedDays},
Upper(GalleryRequests.Selected.LeaveType) = Upper("Jury duty"), {JuryDutyUsed: _requesterBalanceRecord.JuryDutyUsed + _requestedDays},
Upper(GalleryRequests.Selected.LeaveType) = Upper("Bereavement"), {BereavementUsed: _requesterBalanceRecord.BereavementUsed + _requestedDays}
)
),
Set(_managerApprove, true));
Patch(Leave, LookUp(Leave, LeaveID = GalleryRequests.Selected.LeaveID), {Status: "Approved"});
Set(_submittingRequest, false);
Navigate(ManagerChangeRequestScreen, BorderStyle.None);
I made a previous topic on this but I'm not sure I was very clear about the issue I'm having. Previous topic
I'm new here to the forum so I'm not certain how I would go about deleting my old post or updating it, just wanted to clarify the issue.
I attempted adding an altered version of the code: But it did not change. All permissions on sharepoint are set so that a user can edit the form when created by another user so it should be updated. Is there something I'm missing ?
Concurrent(
Set(_submittingRequest, true),
// when approving leave, add the respective days used to the respective used days field
Patch(
Balance,
LookUp(Balance, BalanceID = _requesterBalanceRecord.BalanceID),
{
VacationUsed: If(
Upper(GalleryRequests.Selected.LeaveType) = Upper("Vacation"),
_requesterBalanceRecord.VacationUsed + _requestedDays,
_requesterBalanceRecord.VacationUsed
),
SickUsed: If(
Upper(GalleryRequests.Selected.LeaveType) = Upper("Sick leave"),
_requesterBalanceRecord.SickUsed + _requestedDays,
_requesterBalanceRecord.SickUsed
),
PersonalUsed: If(
Upper(GalleryRequests.Selected.LeaveType) = Upper("Floating holiday"),
_requesterBalanceRecord.PersonalUsed + _requestedDays,
_requesterBalanceRecord.PersonalUsed
),
JuryDutyUsed: If(
Upper(GalleryRequests.Selected.LeaveType) = Upper("Jury duty"),
_requesterBalanceRecord.JuryDutyUsed + _requestedDays,
_requesterBalanceRecord.JuryDutyUsed
),
BereavementUsed: If(
Upper(GalleryRequests.Selected.LeaveType) = Upper("Bereavement"),
_requesterBalanceRecord.BereavementUsed + _requestedDays,
_requesterBalanceRecord.BereavementUsed
)
}
),
Set(_managerApprove, true)
);
Patch(Leave, LookUp(Leave, LeaveID = GalleryRequests.Selected.LeaveID), {Status: "Approved"})
Set(_submittingRequest, false);
Navigate(ManagerChangeRequestScreen, BorderStyle.None);