Skip to main content

Generate Hash Value and Integrate Form Data Third-Party System using API Object.

Problem Statement:

Every document that goes out or comes into Business Central requires some kinda validation to check its originality which confirms the confidentiality of the document.


This blog is a two-step process in which I will be explaining how things work and how to write a code for this.

This blog also is an update on Hannes Holst Blog( and you don't need to access any  .NET variable.


  • Microsoft Dynamics Business Central
  • VS Code
  • AL Language
  • Understanding of how data is transferred using API

Books & References:


1. Creating a Hash Value:
Whenever a file is Uploaded to Business Central Document Attachment Table, Business Central should auto-calculate its Hash value. The Hash Algorithm will be selected on a setup.

  • Creating a Local Hash Value field in the Document Attachment Table.

Document Attachment Table Extension

Hash generated by Business Central

Create a set of the field on Setup Table where you will be selecting the Hash Algorithm.

API Setup for Trokt App

Calculating Hash Value using the Cryptography Management Codeunit. Thanks to Natalie(, who pointed me in the right direction.
Creating HASH Value from File

After the computation of Hash Value, the Third - Party Tool API should be triggered with a parameter as the Hash Value.

2. Integrating API with Third-Party Tool:
When API has triggered with the Hash Value as a form data, the Third-Party Tools recognizes the Hash Value and then auto-computes other parameters and returns their unique value.
API Call with Form - Data payload and storing response

This unique value is going to be stored in the Business Central Document Attachment Table.

Attaching File and getting TROKT HASH in Document Attachment Table

Checking the API Data through POSTMAN passing the HASH Value as a Filtering Parameter
Checking if HASH Value was passed to TROKT API 


Overall, this was the journey as a trial and error process for one of my clients Proof of Concept.
I'm really happy with how perfectly it turned out to be.

Happy New Year !! :)


Popular posts from this blog

Creating APIs in Business Central - 1

While writing a blog on Automated Testing in Business Central, I was going through sample apps provided by Microsoft and realized that the complexity is nowhere close to what examples Microsoft has provided on In this blog, I will try to explain how APIs work and how to be creative with the implementation. Also, an API which were in beta are finally out with version V1.0 in the April 2019 release let's see some important key things from development aspects.
This blog is going to be theoretical one kindly bear with me.

Microsoft Dynamics Business Central (SaaS)VS Code( Language Extension( V1 from Business Central On-Premise DVD
Books & References:
API V1 from Business Central On-Premise DVDAPI(V1.0) for Business Central (Click Here)API(Beta) for Business Central (Click Here)

Key Requirements:
API source table must have an Id(GUID) field per record for m…

How Business Central Modern Client Reverse Compatibility With NAV Can Help You Improve Your Work.

Introduction: Today, I was playing around with Business Central Modern Client (Windows App).
Out of curiosity I was trying to login to one of my NAV 2017 through SSO.
Pre-requisites: Microsoft Dynamics NAV with SSO configured
Microsoft Dynamics Business Central
Demonstration: 1. Business Central App - Main Page:

Clicking on locally hosted service and putting in the credentials configured for NAV 2017 SSO, we get.
Still skeptical when Business Central login into NAV.

2. Business Central App - Reverse compatible with NAV 2017:

Well well well...
Look whose here.
NAV disguised as  Dynamics 365 for Financials.

I think we all agree that Business Central Modern Client is a WebApp version of Busines Central Online. Basically just like browser in an App.
The difference is that it can connect to NAV as it is just like a browser.

3. Does Business Central Modern Client follow DynamicsNAV protocol?:
Well, it simply does not.
It would be amazing  if it did, as it would mean that we could deal with runni…

Generic way of Attaching Documents on any Record of the Page in Microsoft Dynamics Business Central - Template Code

Problem Statement: In Microsoft Business Central, there is a way to attach attachments only on Documents or Master Table records. But, what if this requirement is for other tables such as Opportunities, custom tables, etc. Introduction: I have seen many developers afraid to touch the attachment-related customization as it seems complicated.
Well, I have found a solution and here it goes.
In this blog, I'm attempting to create a generic template for code that needs to have an attachment feature on any table that you like using AL Code.
This means that you simply cannot copy-paste the same code for all the tables but a simple change in variable sub-type will ease your work significantly
Pre-requisites:Microsoft Dynamics Business CentralVS CodeAl Language ExtensionSource Code: Demonstration:1. How it works:
Document Attachment is a table which stores a few things that help in tracking information related to the attachment

The main u…