Hi all!
I've created an app linked to a SharePoint list where I want to prevent the user from submitting the same record multiple times. For example, based on the selection of Quarter and Month, if they have already been selected, it should not allow me to enter a new record. Instead, if they have already been chosen, it should replace the existing record without creating a new one.
There's an exception: if there are identical records from the same combination of quarter and month but created from different users, I need to leave them.
With(
{
_get_record: LookUp(
Chargeability_New,
Month.Value = DataCardValue8_1.Selected.Value && Quarter.Value = DataCardValue8.Selected.Value
),
currentUserID: User().FullName
},
If(
IsBlank(_get_record),
Patch(
Chargeability_New,
Defaults(Chargeability_New),
Frm_Chargeability.Updates
);
Notify(
"Nuovo record creato",
NotificationType.Success
)
);
If(
Not(IsBlank(_get_record)),
Patch(
Chargeability_New,
_get_record,
Frm_Chargeability.Updates
);
Notify(
"Record sovrascritto all'esistente",
NotificationType.Warning
)
);
Navigate('Gallery Screen')
)
I tried this code, but it only works when it overwrites identical records created by the same user. If I enter a record identical to another user's, it still overwrites it; in this case, it should leave them both.
How could I solve this?
Thanks