Below code we have written on button Onselect event. To validate and than Patch.
If(Value(Label7.Text)<>5 && !(IsBlank(DataCardValue2.Text)),Notify("Please enter valid WWID."),
If(
DataCardValue60.Selected.Result = "<select>" || IsBlank(DataCardValue53.Text),
Notify("Please select location."),
Set(
VarStatus1,
"Booked"
);
Set(
varCapacity,
DataCardValue53.Text
);
IfError(
SubmitForm(SharePointForm1),
Notify("Please enter all the required details."),
If(
Value(varCapacity) - 1 < 0,
Notify(
"Something wrong, please do refresh the page.",
NotificationType.Error
),
ClearCollect(
colAfterPatchMaster,
Patch(
Master,
First(
Filter(
Master,
Title = DataCardValue60.Selected.Result && Vaccination_x0020_Date = DataCardValue58.SelectedDate && Slot = DataCardValue24.Selected.Slot
)
),
{Capacity: Value(DataCardValue53.Text) - 1}
)
)
);
Set(
afterPatchCapacity,
First(colAfterPatchMaster).Capacity
);
If(
Value(varCapacity) - Value(afterPatchCapacity) = 1,
SubmitForm(SharePointForm1);
Office365Outlook.SendEmailV2(
User().Email,
"Vaccination Registration is completed successfully.",
HtmlText1.HtmlText
),
Notify(
"Something went wrong..",
NotificationType.Information
)
)
)
));