Tuesday, June 26, 2018

Development with XMLPORT

XMLPORT is used for importing/exporting data from excel , text or XML in NAV.
What are the common requirement for XMLPORT by Client are listed below with ERRORS NAV Developer can face. So get ready to learn and explore.
Requirement 1. SKIP EXCEL Header.
This requirement is common while importing from Excel in NAV tables.
Solution.
Define a Boolean Field and write code as in Screen Shot.
 
Requirement 2.
Use OF EVALUATE Function to convert the Datatype.
Error 1.
Microsoft Dynamics NAV
---------------------------
Data at the root level is invalid. Line 1, position 1.
---------------------------
OK
---------------------------
Solution:

Error 2.
Microsoft Dynamics NAV
---------------------------
'', hexadecimal value 0x03, is an invalid character. Line 1, position 82.
---------------------------
OK
---------------------------
Solution :
Convert your Excel File to CSV Format.
 

Flow of Triggers in XMLPORT during Import of XMLPORT

OnInit
 
OnPre
 
OnAfterInit
 
Text Variable OnAfter Assign
 
OnBeforeInsert
 
OnAfterInsert
 
Root Import
 
OnPost Trigger

Friday, June 1, 2018

What is the difference between ODATA URL and ODATAV4 URL in NAV?

Hi ,

Today while working on API I got this new ODATA V4 url in NAV 2018. Best part is it will help Nav developers to provide JSON data.

Yes this is correct whenever you will give ODATA V4 Login you will receive a json format data from NAV 2018.

ODATA V4 URL :



Result 1 : ODATA URL


Result 2 : ODATA V4 URL



Result 3 : SOAP Result.






Thursday, May 31, 2018

API communication in MS Dynamics NAV 2018 Now Business Central.

Hi All ,

Once again I am getting stuck with calling of API in MS Dynamics NAV in my Germany office so I

thought why not get a dive into the sea of API. And lets check what it is in reality.

What is an API ?

Google says API is an Application Programming Interface. A way which provides us a facility to get 

data from another server.

But I cant understand now also. So lets get some diagrammatic view of an API.

I have a requirement from customer whenever a payment is done by a customer we need to check 

whether the customer has a credit balance to buy the article if no then send the notification to 

customer please contact the owner to increase your credit balance.

So here we were suggested to come with a solution of API we need to create one API which will be 

used by Paypal developers to checks whether this transaction is allowed or not.


I hope you got the point that what is an API.

API is generally a program written to say outer world that we will give you your data just send me 

the url for this requirement. In our example , my developed API will take the parameter of customer 

No. and will check in our customer table below points :

1. Customer Exist or Not.

2. If Exist , check the credit balance and proceed.

I hope concept is clear and requirement is also clear.

So what NAV developers will do now , we will create codeunit and will check the conditions and 

expose it to web service. But now we want to interpret with Paypal and they suggested API.

How to use API in NAV 2018?

First we will see how we can use then we will create API also.

Requirement from NAV Side :

1. Enable your NAV 2018 Admin for Soap and Odata Url.


If you want to go in more deep about API follow this video.




2. Search for API Setup page. Open it and click on Integrate API function it will populate all API present in NAV in Table API Web Service.  This is new system table.

3. We can check the data in Page but we need to create one page for this , as I had created this page on table API Web Service.
Please check how to create page on this table if you dont know in NAV from MSDN.


Lets Run this page.

You can create a web service for this page and check the data for this on browser.

The result of the data will be in JSON Format.

These are the following APIs provided by NAV 2018.


How to call API of NAV?

This is the URL provided by MSDN:

 http://<<Server Name>>:<<OData Port>>/<<Service Name>>/api/beta

For me its :

http://localhost:7048/DynamicsNAV110/api/beta

Hint : If you are not familiar with the url just open web service page and click on URL fields. There are 3 fields

ODATA V4 URL
ODATA URL
SOAP URL

With this you will get the desired URL for your system I followed the same.

After some time the result is as in Screen.


Now if its an API URL it should be present in POSTMAN. Lets check there also the result of our API  data is it available to other world.

For this I will write a new POST.

But I get 1 point now Microsoft is going to Business Central to a next Level of Data Library.