I want to run codeunit function on the basis of users selection.

I have created one page there I have entered CodeUnit Name and Function name, On the basis of inputs I want to run that codeunit functions. Is that possible in NAV

The Codeunit you want to run, is it a Standard NAV Codeunit or a custom (5XXXX)?

With Codeunit.RUN(); you can sent Codeunit No. as parameter, but you can’t send function name.

You need to hardcode all names (and body) of functions from this CU (you can’t change it dynamically, but can select it based on parameter).

It really depends on what you need to do with this.

As said already, then it’s not possible to configure function names in codeunits dynamically. What you need to do, is to “clean-up” your code, so that you end up with only having one “public” function in your codeunits, and to have them called directly from the onRun trigger. This way you only need to call the codeunit with the number and associated record. And that’s possible! [emoticon:c4563cd7d5574777a71c318021cbbcc8]

And since you have been around here on DUG for some time, then you would also know that you should always write which version of NAV/BC your question about. And here it’s important. If you have one of the newer version (after NAV 2016), then take a look at how they have made the Data Exchange definitions. Here they entirely are based on you setting it up by specifying which codeunit number that does what.