Power Automate Create Sales Order from Purchase Order
Recently, I've been playing around with the improvement of Power Automate within Business Central, So I've tested with a scenario below:
Scenarios: Create Sales Order from Purchase Order
I begin by selecting Create action based on a Flow from Purchase Order page. This opens a pop-up page Create a flow, where I select Create from blank
This will take you to PowerAutomate designer page, there is a new New Designer option which is turned on by default. I prefer to work with the old style so I turned it off (you might like the new style)
Give your PowerAutomate a name i.e. Create SO from PO, then select the environment and page or table to connect to
After filled in the info, we need to add input. In this case, I want a Customer Number, which will be used to create the Sales Order.
This will appear on the Purchase Order page when this flow is running.
Click New Step, then choose Dynamics Business Central and select Get Record (V3)
Fill in the info of the env and the API to connect to, in this case is PurchaseOrder API. In the Row ID choose System ID field.
Next step after getting the Purchase Order record, we want to use this to create Sales Order header record. Similar to the previous step, click on New Step then choose Dynamics Business Central and this time select Create record(V3) action
Note: Customer No. is the input from the user that we have added in the very first step above
Next we need to get all the purchase lines. Click on New Step then choose Dynamics Business Central and this time select Find record(V3) action
Enter filter query to be filter only on the Purchase lines that are linked to the Purchase heard record in the previous step Get Purchase Order
Note: Ensure that selected Id is from Get Purchase Order
After getting these Purchase lines, the last step is to create Sales order lines. Click on New Step one more time then choose Dynamics Business Central and this time select Create record(V3) action
Fill in all the info as per previous step, the only different here is the Table name
The next step is to map other fields from Purchase Line to Sales Line, please note that after adding a field, Apply to each action will be added automatically.
Test:
Go to Purchase order page in Dynamics BC, select a Purchase order. Click on Power Automate, you will see your new Flow action button
Voila! Sales order is created
That’s it! Give it a try yourself and share your thoughts on other scenarios where Power Automate could be a better choice than customizing Business Central with AL.
Comments
Post a Comment