Creating documents in Business Central (On-Prem) with Flow


in this blog post, I will write about the possibility to create documents in Business Central with Microsoft Flow.

First I created one SharePoint list where my user will enter information about customer number, order date, item number, quantity.


In the second step, I will create new Flow in Microsoft Flow with When an item is created trigger. Here I will enter site address and list name where my orders are stored.


Next step will be to crate Sales Quote Header in Business Central (On-Prem) and for that action, I need action in Microsoft Flow called Create item.

I will populate fields documentDate with value OrderDate from SharePoint list, customerNumber with value CustomerNo from Sharepoint list.

After that what I want to do is get all the information from my Sales Quote which is created in the previous step. To do that I will use an action called Get item for Business Central (On-Prem). Here I will specify company name, table name, and row id.


Next what I want to do is to get information about Item which I will use, and to do that I will use Get Item action for Business Central (On-Prem). In this step, I will specify company name, table name, and row id.

If I leave configuration like this Flow will look for items in Item table by ID field which is not so user-friendly. What I want is to look for items based on Item number which is entered in SharePoint List. To do this I will go to Microsoft Dynamics NAV Development Environment and modify page 5470 Item Entity to use ODataKeyFields = No. instead of ID which is shown in 2 following pictures.

Now when I have information about Sales Quote Header and Item which I will use I am ready to use information for Sales Quote Line.

For that, I need Create Item action for Business Central (On-Prem), and choose Company name, Table name.

In the itemId field, I will choose Id from GetItems action in which I get information about Item from SharePoint List.

In the lineType, I will enter “Item” because I will only insert items, in unitOfMeasureCode I will choose baseUnitOfMeasure code and unitPrice from GetItems action. In the field quantity I will choose Qty field from SharePoint List.

The final step is to define for which document number I am inserting this lines. If you scroll down action which I used for creating Sales Quote Lines you will see that there is no documentID or document number.

To connect documentID from Get Sales Quote Header action and documentID from Create Sales Quote Line action I need to export my flow to json file and find definition.json.

When I open definition.json file I need to insert one line of code as specified on the picture below.

Now import back this Flow and you should have something like on the picture below.

And when you enter information in SharePoint list document Sales Quote will be auto-generated with lines.

Note: this flow and scenario will work only if you have relation one to one between header and lines. In future blog posts, I will describe one of the concepts how to insert multiple lines.


Renato 🙂


Copyright ©[year] All rights reserved. Powered by Derecjun

Log in with your credentials

Forgot your details?