How to Create Custom Connector in Power Apps to Integrate With Business Central

Hi Readers,

I hope you and your family are healthy and safe during these unprecedented moments.

Today I was working on MS Dynamics 365 Business Central and would like to integrate my custom tables into power apps, I have checked many blogs but there is no clear documentation on it.

So I would like to write and share it with you.

Before going to start I would like to discuss some prerequisites and overviews.

Introduction/Aim:

  • Power Apps is a suite of apps, services, connectors, and data platform that provides a rapid application development environment to build custom apps for your business needs.
  • I would like to implement WMS features through power apps, Like, Scanning picks, Registering Picks, Printing labels, and so on.
  • Creating a Custom Connector and accessing Business Central data from PowerApps.
  • PowerApps provides a connector for most of the Business Central pages of type API.

Pre-requisites:

  • Microsoft Dynamics 365 Business Central
  • Microsoft Visual Studio Code
  • Microsoft Power Apps

Demonstration:

Creating a Custom Connector and accessing Business Central data from PowerApps

PowerApps provides a connector for most of the Business Central pages of type API.

API Pages
API Pages

 

Power Apps Connections
Power Apps Connections

If you would like to access any other Business Central tables from PowerApps other than the list above, following are the steps to create a Customer Connector in PowerApps,

1> Create and publish the Pages with type as API in Business Central for the tables which have to be included in the custom connector

Warehouse Pick API Page
Warehouse Pick API Page

 

Warehouse Pick Line API Page
Warehouse Pick Line API Page

2> You can check with Postman or a similar app to make sure the Pages are accessible

Postman Testing
Postman API Testing

3>Go to PowerApps -> Data -> Custom Connectors -> New Custom Connector -> Create from blank

Create Custom Connector
Create a Custom Connector

Enter a Name for the Connector and click Continue

Create Custom Connector 2
Create Custom Connector 2

 

4> Enter the Description, Host, Base URL, and other details on the General tab.

Create App
Create App

5> Click on the Security tab and select the authentication type as Basic Authentication and enter the parameter label.

Create App - 2 (Security)
Create App – 2 (Security)

6> Click on Definition and then click on New action, enter the Operation ID and other details,

Create App - 3 (Definition)
Create App – 3 (Definition)

Click on “Import from a sample” to update the request URL and other details,

Create App - 4 (Import Request)
Create App – 4 (Import Request)

Select the operation type, GET and enter the URL of the Business Central Page, if required with the company filter and click on Import

Select the operation type
Select the operation type

Click the assist edit of the company and mark it as mandatory and select a default value as below,

Create App 6
Create App  – 6

 

Create App - 7
Create App – 7

Click on “Add default response” and copy and paste the response of the Get operation from the postman or similar app in the Body section. This is used to identify the data fields for the operation.

Add default response
Add default response

 

Postman Response
Postman Response

 

Import Postman Response
Import Postman Response

Check the Validation section, it must show Validation succeeded.

Validation succeeded
Validation succeeded

7> Click on New action and include other tables to be added in the connector if required in the same way.

Add action
Add action

8> Click on Create Connector when completed to create the custom connector.

9> Now we can use the connector created above in an App.

Click on Apps -> New app -> Canvas

Create Canvas App
Create Canvas App

10> Select Phone Layout (or Tablet Layout)

Select Layout
Select Layout

11> In the App, click on “Data sources” and search for the custom connector just created.

Select the connector, enter the username and password to add the connector to the app.

Enter Data sources credentials
Enter Data sources credentials

12>Now insert a “Reload” Icon by going to Insert -> Icons -> Reload

In the OnSelect property of the control enter the following code,

ClearCollect(PicksCollection,warehouse.Pick(“demo”))

This will load the “Pick” data from “demo” company using the “warehouse” connector into the

Collection(table) name “PicksCollection” in PowerApps.

Add code for the refresh button

Add code for the refresh button

13> Now add a Gallery control to show the Pick data from the “PicksCollection” Insert a Gallery Control from Insert -> Gallery -> Vertical

Change the layout to Title, subtitle, and body

add a gallery control
add a gallery control

 

Edit Fields
Edit Fields

Enter the expression for the Items to show the records from the PicksCollection and click “Preview the App” icon or (F5) to see the PickList from Business Central

Add code for refresh button

 

Result:

Result
Result

To implement the WMS feature in the NAV / Business Central please Contact VLC Solutions.

VLC Solutions has multiple Apps /Add-ons for NAV & Business Central to meet your business goals and make your business more productive.

For today that’s it, Thank you for reading.
Feel free to share your opinion on the below comment box.