Skip to content
+1-888-319-3663

EONE BLOG

Tech Tuesday: Using SmartConnect to Post Business Central Sales Orders


This week we are going to discuss how to use SmartConnect to post Sales Orders in Business Central. This functionality is available through the Business Central client, but not in the web services. The business logic used to batch post Sales transactions is stored in a Codeunit. This means we can use AL code to create a web service that calls the posting Codeunit.

*Note that any code provided is for use as a point of reference and will not be supported by eOne Solutions.

Creating the Service

The purpose of the service is to recreate the Batch Posting window. This means we will need all the fields in the Options section, and a method of filtering for only a selection of records.

We can accomplish this by creating a table with all the information needed for posting. Then set a trigger on the table to do the posting.

Once the table is setup, we need to create a page that can be published as a web service. This page will be an API only page, because users have no reason to access this page through the Business Central client. This will be a simple page that SmartConnect will use to interact with the table we just created to post the batch.

 

Reporting and Security

All these options and settings are being imported to a Business Central table, therefore we can create a simple list page to allow users in Business Central to view previously posting settings used when posting through the API. In the example link I have created a simple example of a list page(50112) as a reference, and it can be expanded on as desired.

All AL Tables require a Permission Set to ensure access can be granted as needed. So, we will need to add a permission set to our extension in an XML file.

SmartConnect Mapping

Once the extension is published, the web service will be automatically published. From within SmartConnect it will now be available as a destination. The mapping would look like the below screen shot. There are two options for ‘DocumentType’, Invoice and Order. In my example I used a source that contained the date ranges I wanted to use for posting. All of these can be set dynamically using calculated columns so the posting process would not require any manually processing.



GitHub repository with sample code.

Leave a Comment





RECENT POSTS


2021 Q4 Promotions
Connect with us at Directions EMEA 2021 in Milan!
eOne at Summit North America 2021
Employee Spotlight: Megan Tripp, Business Development Representative
eOne is now compatible with Microsoft Dynamics GP October 2021 Release

POPULAR POSTS


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships partners Popdock release Reporting SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.