How to run codeunit through dll?

How to run codeunit through dll in NAV 2016 version???

Exactly what do you mean? What is your requirement?

Basically I need How to create dll file & In this dll file I need to call nav codeunit function.


Expose the Codeunit as a Webservice and call it from .dll.

But if the codeunit has to run after some action has happened via Webservice (insert, modify, etc.), I would recommend using an Eventsubscriber codeunit.

best regards,

Thomas Barbut

You can do as Thomas said or you can use the Invoice-NAVCodeunit from Powershell throw .NET

I have not testet it - but I think that this PS-command only exists in NAV 2017 and NAV 2018.

If we go that direction, then there are also other external solutions, which allows you to call a codeunit from the outside, and on “older” versions.
Just an example:

Hi Palle,

Actual it is in NAV 2016 (testet) and I can find the command in NAV2013R2 module

Cool… I tried to find the command in my old NAV 2016 image, and it wasn’t there. I guess we need a build-upgrade at the customer soon :slight_smile:

Hi All Thanks for the replies. It is possible User can run Code-Unit functions on selection basis. I have one Master page User gives input Code-Unit Name & Function Name then I have one transaction process When these process run this Functions run on the basis of Inputs. And also I want to pass Parameters to those functions.

My Experience with stuff like this is that it easily gets to complicated just to transfer and validate the data you want to be handled with an execution of a codeunit. I would STRONGLY suggest that what you do is use the web service functionality. Here you can easily import-data (a page) and execute some handling of that date (a function)

using a nav web service takes care of most of the validation of the data - and you have to worry very little about it.

Actually My organization having one AX Functionality.They have created Expression engine in AX & We need to create same expression engine in NAV.

In AX they create Expressions. In that expressions they define formulas eg. (BasicSal= Rate* (Hours-Absence Hours)) For that calculation they created one field in Employee Table and assign BasicSalary as Expression for that employee On that basis of expression values System automatically run Rate, Hours, Absence Functions at the time of Transaction process and Calculate Basic Salary of that employee.

I believe using code-unit exposed a Web-Service would be the best approach for you!!