17 Dec’18

D365 Business Central

Configure Web Services through Code in Business Central

Introduction:

When coding an app that uses Webservices to connect to the integration solutions, it is generally recommended that there is a Setup, which we can configure, where the Webservices are created as well as deleted.

Pre-requisites:

  1. Business Central
  2. VS Code with AL Language Extension

Demonstration:

  1. Create a Setup Page having a boolean variable say ‘SetupExtension‘ and create a field having value as ‘SetupExtension Variable’.

    Output:
  2. On the OnOpenPage trigger add a code to Check if Web Services are already created and accordingly set the ‘SetupExtension‘ boolean field.

    Thus, whenever the Setup Page is Opened, the ‘SetupExtension‘ field is set as per the records in Web Services.
  3. On the OnQueryClosePage trigger write a code which will create the Web Services when ‘SetupExtension‘ boolean is set as ‘TRUE‘ and delete the Web Services if ‘SetupExtension‘ boolean is set as ‘FALSE‘.


    Output:
    i. When ‘SetupExtension‘ is set to ‘TRUE



    New Webservices are created.
    ii. When ‘SetupExtension‘ is set to ‘FALSE



    Web Services are deleted. 

Conclusion:

Thus this way we can keep the existing app installed and enable/disable Web Services as needed. As compared to creating WebServices.xml file which directly creates the Web Services on installation of the app, I’ll be demonstrating it in my next blog.

Written by

Olister Rumao

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Integrate Dynamics 365 for Customer Engagement Apps with Microsoft Teams

    18 June’ 2019

    Before getting into details, firstly I would like to talk about Microsoft Teams. If you’re familiar with MS Teams, you...

    Read more
  • Applying Default / Mandatory Dimension in NAV / Business Central

    17 June’ 2019

    Introduction: In this blog, I aim to provide how to set Mandatory Dimensions on Items, Customers, Vendors, and G/L Accou...

    Read more
  • Automatically adding dimensions from Shortcut Dimension from Excel Import in Microsoft Dynamics NAV / Business Central

    17 June’ 2019

    Problem Statement: I have a requirement where the contents of the General Journals are to export to Excel and also can c...

    Read more
  • Using “startswith” Filter Query in MS Flow

    12 June’ 2019

    Introduction This blog explains how to use “startswith” filter query in MS Flow. Use Case Using MS Flows to retrieve...

    Read more
  • Print pro-forma invoice in Dynamics 365 Finance and Operations

    11 June’ 2019

    In this article I am going to demonstrate how to view/print  pro-forma invoice. A pro forma invoice is an invoice that ...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.