Hi
I'm trying to display a custom error message if a Patch() fails. It's not displaying my text but just the standard message. Please see my code below. I have turned on formula error processing in setting for the app. Any clues?
Thanks for any insights 😊
If(
nErrorCount < 1,
Patch(
'DocuLibrary',
LookUp(
'DocuLibrary',
ID = glbSelectedDocID
),
{
'Sign Off Status': "In Progress",
ExpectedApprovalCount: nApproverCnt,
ApprovalRequester: CompUser.Email,
'Approved by Date': DateValue(dteApprovedByDatePicker.SelectedDate)
}
);
//if it fails display error, try again
If(
!IsEmpty(Errors('DocuLibrary')),
Set(Msg0, $"{First(Errors('DocuLibrary')).Message}");
Notify(
Concat(
Errors('DocuLibrary'),
Msg0 & " - Failed to update document for workflow, please try again."
),
NotificationType.Error
);
, //else, update approval history list
….stuff here…..
); //end of update code
Hi @Flyingfishnm ,
Please try this:
1\ Use
If(
nErrorCount < 1,
Patch(
'DocuLibrary',
LookUp(
'DocuLibrary',
ID = glbSelectedDocID
),
{
'Sign Off Status': "In Progress",
ExpectedApprovalCount: nApproverCnt,
ApprovalRequester: CompUser.Email,
'Approved by Date': DateValue(dteApprovedByDatePicker.SelectedDate)
}
);
//if it fails display error, try again
If(
IsEmpty(Errors('DocuLibrary')),
// update approval history list
….stuff here…..
); //end of update code
Besides, set the onError property of app to:
Set(Msg0,$"{First(Errors('DocuLibrary')).Message}");Error(Concat(Errors('DocuLibrary'),Msg0&" - Failed to update document for workflow, please try again."))
Best Regards,
Wearsky
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional