Hi @jdellipa - to display an error message, you could try the following pattern:
If(
IsError(
Patch(
'YOUR_DATA',
Defaults('YOUR_DATA'),
YOUR_FORM_NAME.Updates
)
),
// On failure
Notify(
If(//check for duplicates
!IsBlank(
LookUp(
'YOUR_DATA',
YOUR_NUMBER_COLUMN = YOUR_DATA_CARD_VALUE
)
),
"Duplicate", //if there is a duplicate, show this message
"Some other Error" //if there is not a duplicate but there is a different error, show this message
),
NotificationType.Error
),
// On success
Notify(
"Saved",
NotificationType.Success
)
)
Alternatively, you could separate out the duplicate check and leverage it for anything else. For example you could wrap the below formula around an IF condition to display a specific message, or you could apply the formula to the DisplayMode property to the save button and set it to disabled if the formula returns true.
!IsBlank(
LookUp(
'YOUR_DATA',
YOUR_NUMBER_COLUMN = YOUR_DATACARD_VALUE
)
)
//true if there is a duplicate
//false if there is not a duplicate