Announcements
Hi Folks,
I have been stuck with the posting of sales invoice using the power automate by calling the action as a request.
I have tried some AL code to call the default codeunit then expose it as API and use it in Power Automate. Here is the code i tried
As Nitin Verma suggested earlier, you need to manage to hide the dialogs. To do this, I think you have to find the specific event in your code unit "Sales-Post (Yes/No)" which is responsible for showing dialog, I had a similar requirement a few days ago, and this is how I hid the dialog when posting General Entries.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post", 'OnBeforeCode', '', false, false)] local procedure OnBeforeCode(var GenJournalLine: Record "Gen. Journal Line"; var HideDialog: Boolean); var RoyaltyParameters: Record uerRoyaltyAllocationParameters; begin if RoyaltyParameters.Get() then begin if (RoyaltyParameters.uerShowPostInvoiceDialog = false) then begin HideDialog := true; end; if (RoyaltyParameters.uerShowPostInvoiceDialog = true) then begin HideDialog := false; end; end; end;
Regards.
Please use Sales-Post codeunit instead of Sales-Post (Yes/No)
Hi Nitin Verma ,
Appreciate your help on this!
As a newbie, I am not much familiar about handling those dialogs in Business Central
Can you guide me with any reference or a sample snippet
This codeunit you are using it will raised and confirm dialog, are you able to manage those dialog's options, like Ship, Invoice and Ship & Invoice?
Thanks.
Hi Govinda Kumar,
Here is the screenshot of the procedure i have created inside an api page named salesInvoices.
I have used the above in power automate by the following step
Hi,
It would be helpful if you show the screenshot of exposing it in API and using it in power automate.. and parameters you're passing in the procedure..
Regards
André Arnaud de Cal...
294,206
Super User 2025 Season 1
Martin Dráb
232,968
Most Valuable Professional
nmaenpaa
101,158
Moderator