As I understand I probably want to be able to call a function on a codeunit defined at a run time, CODEUNIT.RUN(number_coming_from_some_setup_table), without declaring the actual codeunit as a variable?)
In NAV 2016+ you can get similar functionality using events. In calling code define publisher function, and call that function (instead of CODEUNIT.RUN), and in called codeunit define a subscriber subscribing to the publisher function in calling codeunit.
You would probably need some extra logic to ensure that only one subscriber executes desired code (manual binding or smth)
In older versions (without events) it is not possible.
You could try to mimic the behavior by calling the CODEUNIT.RUN on a record, and depending on the values passes call different functions, but at the end of it you wll require a place where called codeunit is defined as a variable anyway - so you would have to know its details at design time.
Answers
In NAV 2016+ you can get similar functionality using events. In calling code define publisher function, and call that function (instead of CODEUNIT.RUN), and in called codeunit define a subscriber subscribing to the publisher function in calling codeunit.
You would probably need some extra logic to ensure that only one subscriber executes desired code (manual binding or smth)
In older versions (without events) it is not possible.
You could try to mimic the behavior by calling the CODEUNIT.RUN on a record, and depending on the values passes call different functions, but at the end of it you wll require a place where called codeunit is defined as a variable anyway - so you would have to know its details at design time.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!