17 Dec’18

D365 Business CentralConfigure 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

  • Integrating Site24x7 into Microsoft Teams

    19 March’ 2019

    Introduction: Microsoft Teams is a cloud-based chat and collaboration platform, designed to simplify group work. It is...

    Read more
  • Manage and secure Dynamics 365 for Customer Engagement documents in SharePoint Online

    18 March’ 2019

    Introduction: When you check your Dynamics 365 Customer Engagement Entity records, you might think where your documents ...

    Read more
  • How to control the amount of information that is visible in a window in Business Central.

    18 March’ 2019

    Introduction: This blog demonstrates how the information that is visible to a user on the window can be controlled and m...

    Read more
  • PSA Quick Tip: Use Project instead of Project Template while creating a project in PSA V3

    15 March’ 2019

    Problem definition Often clients using PSA V2 used to complain of the feature missing was copying the project as the tem...

    Read more
  • Getting the price right post the time entries are approved in PSA

    15 March’ 2019

    PSA demands a perfect configuration and that is the proof of being a sophisticated application. You won’t see any resu...

    Read more