trigger OnAfterDelete()
var
ABC: Codeunit ABC;
begin
ABC.DeleteItemFrom3rdPatyApp(Rec./No./);
end;
I make this API call within the OnAfterDelete trigger in the Item table extension. However, if an error occurs from the third-party application, I need to insert the error response into the Integration Logs table and also need to show that error to the user in the web client. The challenge here is that when an error occurs, Business Central automatically rolls back all transactions, including the insertion of the error response into the Integration Logs table.
When I use the Commit() function, it also deletes the corresponding item from BC.
My goal is to prevent the deletion of the item from Business Central in the OnAfterDelete() trigger while still being able to insert the failed response into the Integration Logs table. If anyone could provide guidance on how to achieve this functionality, I would greatly appreciate it. Thank you for taking the time to read this.