Parameter in codeunit

BlizzardBlizzard Member Posts: 9
Hi folks,

I want to adjust a parameter in a standard codeunit of Navision that is on the OnRun trigger, but it appears to be non editable. Is it possible to modify it anyway and if yes, how please?

Thankx

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    No, this is not possible.

    You can call a codeunit with a Record only.

    If you want to use a parameter you need to create a new function withing the codeunit and define the codeunit as variable before you call it.
  • DenSterDenSter Member Posts: 8,307
    or use a record variable that has a field of the datatype that you need :).
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Yes, you can do that, but please not with a standard NAV codeunit. You can mess things up terribly.
  • DenSterDenSter Member Posts: 8,307
    of course :mrgreen: it is much easier to screw it up than to do it right.

    Typically, you would only do CODEUNIT.RUN if you have a legitimate record variable to send. If you don't then you write a function (or more precisely a 'procedure') that can accept your parameters.

    You could also write some functions to set global variables from another object. Then you create your codeunit as a global codeunit variable, and you call those functions. Then after the globals are set you call codeunit.RUN.
Sign In or Register to comment.