04 November 2018

Getting Started with Dynamics 365 Business Central APIs



API (Application Programming Interface) is an interface which allows applications to talk with each other. Simply put, it is more like a website, where you make a call to the server and you get a response from the server. 

Dynamics 365 Business Central (D365BC) expose many "ready-to-use" APIs which allows seamless integration experience between other service offerings and Dynamics 365 Business Central. Spring 2018 release introduced this new capability to Dynamics 365 Business Central (D365BC) and from every month "ready-to-use" API count is growing. 

Apart from "Ready-to-use" APIs, a user can build their own custom APIs and that will discuss in a separate blog post. 

This blog post will go through basic API requests and will show how to use Postman to test these. 

I have created a collection called "Business Central - API" and in that, I have defined 2 variables so I do not have to type the Base URL over and over and also to store the tenant ID.

Base URL:

 https://api.businesscentral.dynamics.com/v1.0/<your tenant domain>/api/beta  

You need to replace <your tenant domain> with your Business Central ID. 

In the "Authorization" tab set the type to "Basic Auth" and enter Username and Password to login into Dynamics 365 Business Central (D365BC). In here I used Web Service Access Key to login to Dynamics 365 Business Central (D365BC). 

Get Records
Once the Base URL and authentication is set you can create a GET method for {{BaseURL}} which brings all the available APIs as below:

How to retrieve a list of companies available

 {{BaseURL}}/companies  

Return JSON will have all the available companies and their unique IDs

If I want to work with one specific company, then you can store the company ID in an environment variable in Postman. This will make life easy if you going to use this ID in multiple requests. 


I have used a small JavaScript to store the company ID based on the response body. You can achieve this by simply navigating to Test tab and pasting the below script. What this script does it, it cast "responseBody" to a JSON data and then read the company id and the value to "Env_companyID" variable. 

 var JsonData = JSON.parse(responseBody);  
 postman.setEnvironmentVariable("Env_companyID", JsonData.value[0].id);  


Once the script is complete simply execute the {{BaseURL}}/companies. This will return the list of companies and our small JavaScript will store the first company ID in "Env_companyID" variable. 

Now with the stored "Enc_companyID", you can filter the return JSON. 

 {{BaseURL}}/companies/{{Env_companyID}}

From that forward your any request will work on that filtered company. 

Get all the General Ledger Accounts


  {{BaseURL}}/companies/{{Env_companyID}}/accounts


Get all the customers and store first customer ID in Environment Variables


  {{BaseURL}}/companies/{{Env_companyID}}/customers

Set below script it test tab:
 var JsonData = JSON.parse(responseBody);  
 postman.setEnvironmentVariable("Env_customerID",JsonData.value[0].id);  


Filter Records

In this we are filtering customers based on Customer ID we stored in environment variables. 
  {{BaseURL}}/companies/{{Env_companyID}}/customers/{{Env_customerID}}


Update Records

We need "@odata.etag" to update records in Dynamics 365 Business Central (D365BC). Use below JavaScript to store etag in Environment Variables. 

 var JsonData = JSON.parse(responseBody);  
 postman.setEnvironmentVariable("etag", JsonData["@odata.etag"]);  


Once the script is ready to send the request and get the response back. That will set the etag in the Environment Variables. 

After the etag is set we need to change our method to "PATCH" and in the header tab set the "Content-Type" to "application/json" and add another key 'If-Match" and set the value to {{etag}}


In the body of "PATCH" request add below JSON. This means to change the display name to "Tailspin Toys - Update"
 {  
    "displayName": "Tailspin Toys - Update"  
 }  


Execute the command and return JSON will have updated "Display Name"


There are many new possibilities opens up with new APIs and will post more about new APIs and custom APIs. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara
Read more »

11 August 2018

What is Docker? What are Containers?

Every year Microsoft is releasing a major version of Microsoft Dynamics NAV and on top of that, they release monthly updates for each of these versions. You would love to have all your clients and developed add-ins to be only in the latest version of Microsoft Dynamics NAV. However, we all know that is far from happening (At least for most of us).

Technical and functional consultants required to access these different versions all the time. So what is the best way to manage these different versions by keeping the fact of easy access? 

Is the best way to install all the versions on one big server? If so next question to answer is how to manage shared resources and conflicts? or to have virtual machines per each version of Microsoft Dynamics NAV? Once again running into a resource issue. 

What is the best way forward? for me, the answer is  Docker and Containers!

What is Docker? 
Docker is a containerization platform. In other words, Docker is a software platform which allows to build, test, and deploy applications with no time. 

The key benefit of Docker is that it allows users to package an application with all of its dependencies into a standardized unit for software development, Shipment, and Deployment. This standardized unit is called as containers. 

Docker was first released in the year 2013 and it was developed by Docker. 

What is the Container?
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.

Container images become containers when they run on Docker Engine (During runtime). Containers are available for both Linux and Windows-based applications, the containerized software will always run the same, regardless of the infrastructure. 

Containers provide a higher level of isolation. Which means each container on Docker has its own registry, file system, network layer with its very own published ports and memory space. 

Are Containers and Virtual Machines are the same?
In a way, Docker and Containers are a bit like virtual machines, but unlike virtual machines rather than creating a whole virtual operating system, Docker allows applications in the container to use the same kernel as the system that they are running on. This means container should only need to have things which are not available on the host computer. This allows containers to be lightweight and also to provide a good performance boost. 



















Containers run on total isolation and this allows you to run multiple instances of containers side by side without any conflicts. Only you will know that you are working on multiple container instances at the same time. 

Another advantage of containers is they are instant on, just like your TV. Whan, you run a container it does not have to go through all the initializations like normal computers, they know where to pick it up from. Containers also eliminate environment inconsistencies and the "works on my machine" problem by packaging the application, configs, and dependencies into an isolated container.


Is Microsoft release Docker images for Dynamics NAV?
YES! Microsoft does release Microsoft Dynamics NAV Container images to public Docker Hub.

How can a Containers be helpful to a NAV developer?
If you want to work and test your code on different versions of Microsoft Dynamics NAV, then Docker containers are the best solution. You do not have to create and configure different VMs to develop and test your code. Once you download the Container Image from Docker Hub you can easily clone the image and setup multiple instances within minutes. 

How can I get started with Docker and Containers?
Stay tuned for my next blog post, or if you are in a hurry then read Freddys blog. 

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara
Read more »

02 July 2018

Third consecutive year as a Microsoft Most Valuable Professional (MVP) - Business Applications

Third consecutive year as a Microsoft Most Valuable Professional.


It is a great honor to receive the Microsoft Most Valuable Professional (MVP) award. 

Thank you, everyone, for helping me out on this great journey. 

Thank you and Regards,
Tharanga Chandrasekara
Read more »

09 May 2018

Dynamics 365 Saturday - Melbourne 2018

I will be taking the stage this Saturday with Wagner Silveira at Dynamics 365 Saturday - Melbourne to talk about "Richer integration with logic apps for Microsoft Dynamics NAV and Dynamics 365".

Join us.

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara
Read more »

14 April 2018

Directions Asia 2018 Bangkok: MVPs report back

The original post is posted in Theta's Official Blog

Directions is the biggest Microsoft Dynamics NAV conference in the world, and was held for the second time in Asia, on 15th and 16th March in Bangkok. It’s an independent conference for Microsoft Dynamics partners from the ERP and CRM channels focusing on the small and medium-sized business (SMB) market, organised by partners, with the help of Microsoft.

Attending any Directions conference is always an advantage for any professional involved in the Microsoft Dynamics platform, as the conference provides the perfect environment for knowledge sharing, networking and discovery of new opportunities for future growth and collaboration.

This year we had the opportunity to send Theta’s two Microsoft MVPs, Tharanga  Chandrasekara and Wagner Silveira, to Bangkok, not just to attend the conference, but as presenters at Directions ASIA, selected and sponsored by the Directions committee. Here is what they have to say about the experience.


Integration at a Microsoft Dynamics Conference?


Precise, up-to-date information is key to a successful business, as it adds real value to the decision-making process, making it faster and more reliable.

Today, ERP and CRM systems are entwined, making it hard to implement one without the other. But a reliable and conflictless integration is quite hard to achieve. The standard Microsoft Dynamics NAV CRM connector works perfectly when a point to point integration and data flow direction are unidirectional - “To Integration Table” or “From Integration Table”. 


But the Microsoft Dynamics NAV CRM Connector faces difficulties when integration requirements become multi-point or bi-directional. So what are the alternatives?


We decided to share our experience integrating Microsoft Dynamics 365 and Microsoft Dynamics NAV with the community, demonstrating new integration possibilities and best practices.


During our session, we brought together our two areas of expertise to discuss patterns to integrate Microsoft Dynamics NAV and Microsoft Dynamics 365 (CRM) when multi-point or bi-directional integration is required. We demonstrated the use of Logic Apps with Microsoft Dynamics NAV to achieve bi-directional, close to real time, multi-point integration scenarios.

The audience was engaged and enthusiastic, and especially interested in the three demo scenarios, which showed the new capabilities Logic Apps can bring into the world of Microsoft Dynamics.


Conference highlights
During the conference, Marko Perisic (General Manager, Microsoft Dynamics SMB) announced Microsoft Dynamics 365 Business Central.

Business Central
Microsoft Dynamics 365 Business Central brings the full power of Microsoft Dynamics NAV to the cloud, as a modern solution for modern businesses. Along with the new capabilities, the application will include an all-new user experience. With a familiar Microsoft Office 365 user interface, personalised feeds, smart notifications, embedded AI capabilities – amassing over 100 new functionality items, Business Central enables users to work smarter and be more productive than ever before.


The conference was a huge success, and we’re looking forward to attending again next year.

Microsoft Dynamics 365 Business Central will be generally available on April 2, 2018, in 14 countries (United States, Canada, United Kingdom, Denmark, Netherlands, Germany, Spain, Italy, France, Austria, Switzerland, Belgium, Sweden, and Finland) and will be available through the Cloud Solution Provider (CSP) channel. The solution will be generally available in Australia and New Zealand from July 1, 2018.


DXtFyHHU8AA3v-c.jpg
Tharanga Chandrasekara, a senior consultant in our ERP team, and Wagner Silveira, Theta's principal integration architect, are both Microsoft MVPs, and were invited to present at this conference by the Directions committee.







Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara
Read more »

14 March 2018

Microsoft Dynamics 365 Business Central is now official

While waiting at Auckland Airport for my flight to Bangkok to attend Direction Asia, I got a pretty exciting mail from my MVP group.

Microsoft Dynamics 365 Business Central is now official! 


Generally available beginning April 2nd, Business Central offers businesses a single, end to end solution for managing finances, operations, sales and customer service, and an opportunity to easily upgrade from entry-level accounting software and legacy ERP systems.

Dynamics 365 Business Central will be generally available on April 2, 2018, in 14 countries – United States, Canada, United Kingdom, Denmark, Netherlands, Germany, Spain, Italy, France, Austria, Switzerland, Belgium, Sweden, and Finland, purchased through Cloud Solution Provider (CSP) partners. 


Australia and New Zealand will be generally available beginning July 1, 2018.

You can read more about this exciting news on clicking here

Will Tweet and blog about Microsoft Dynamics 365 Business Central when we heard more during Direction Asia. 


Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara
Read more »

15 February 2018

List of System and Hidden Tables - Microsoft Dynamics NAV 2018


Below is the list of Virtual and System tables in Microsoft Dynamics NAV 2018. 

Some of these hidden tables save hours of work for developers if they used properly.




10 New System tables added in NAV 2018
Object ID
Object Name
Object Caption
2000000081
Upgrade Blob Storage
Upgrade Blob Storage
2000000082
Report Layout
Report Layout
2000000176
NAV App Resource
NAV App Resource
2000000177
Tenant Profile
Tenant Profile
2000000178
All Profile
All Profile
2000000179
OData Edm Type
OData Edm Type
2000000182
Media Resources
Media Resources
2000000186
Profile Page Metadata
Profile Page Metadata
2000000187
Tenant Profile Page Metadata
Tenant Profile Page Metadata
2000000188
User Page Metadata
User Page Metadata


02 New Virtual and Hidden Tables added in NAV 2018
Object ID
Object Name
Object Caption
2000000192
Page Control Field
Page Control Field
2000000193
Api Web Service
Api Web Service


List of all Hidden / Virtual Tables in NAV 2018
Object ID
Object Name
Object Caption
2000000001
Object
Object
2000000007
Date
Date
2000000009
Session
Session
2000000020
Drive
Drive
2000000022
File
File
2000000026
Integer
Integer
2000000028
Table Information
Table Information
2000000029
System Object
System Object
2000000038
AllObj
AllObj
2000000039
Printer
Printer
2000000040
License Information
License Information
2000000041
Field
Field
2000000043
License Permission
License Permission
2000000044
Permission Range
Permission Range
2000000045
Windows Language
Windows Language
2000000048
Database
Database
2000000049
Code Coverage
Code Coverage
2000000055
SID - Account ID
SID - Account ID
2000000058
AllObjWithCaption
AllObjWithCaption
2000000063
Key
Key
2000000101
Debugger Call Stack
Debugger Call Stack
2000000102
Debugger Variable
Debugger Variable
2000000103
Debugger Watch Value
Debugger Watch Value
2000000135
Table Synch. Setup
Table Synch. Setup
2000000136
Table Metadata
Table Metadata
2000000137
CodeUnit Metadata
CodeUnit Metadata
2000000138
Page Metadata
Page Metadata
2000000139
Report Metadata
Report Metadata
2000000140
Event Subscription
Event Subscription
2000000141
Table Relations Metadata
Table Relations Metadata
2000000142
Query Metadata
Query Metadata
2000000154
Database Locks
Database Locks
2000000164
Time Zone
Time Zone
2000000167
Aggregate Permission Set
Aggregate Permission Set
2000000171
Page Table Field
Page Table Field
2000000172
Table Field Types
Table Field Types
2000000173
Finish Design Save Mode
Finish Design Save Mode
2000000178
All Profile
All Profile
2000000192
Page Control Field
Page Control Field
2000000193
Api Web Service
Api Web Service








Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara
Read more »