I am working with Business Central Online, in AL.
We have an integration that creates sales orders in BC.
When the order is created, the code is to make an approval request. I trigger this through an API request after the order and all items have been added.
[ServiceEnabled]
[Scope('Cloud')]
procedure CreateApprovalRequest()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
if ApprovalsMgmt.CheckSalesApprovalPossible(Rec) then
ApprovalsMgmt.OnSendSalesDocForApproval(Rec);
end;
The issue is we are using an integration account, not a real user, and the integration account is not in the approval user setup, so it is failing.
Is there a way around this? Another approach I can take to try and automate the creation of the approval request?