I find there are some parameters in the codeunit such as “purch.-post”,"“purch.-post+print”. It is defined as OnRun(VAR Rec : Record “Purchase Header”). But when I define a new codeunit and also want to add some parameters to the functions OnRun(), I find the parameters of C/AL local can’t be edited or added. how can I add the parameters to OnRun()? Any help is welcome. Thanks in advance.
Hi, OnRun trigger is created by the Navision by default when you create the codeunit.Your query is how some codeunit is having parameter and some codeunit is not. System will not show any parameter in all those codeunit which table no. property is not set. To add the parameter in OnRun() trigger open the codeunit in design mode and set the table no. property of codeunit. OnRun trigger can have atmost 1 parameter because you can assign only one table to Table No. property of codeunit.
Gillie, If you want additional parameters set when executing a codeunit you could create one or more “property” functions in the codeunit, i.e. SetStartValue(value : Integer) StartValue := value; where StartValue is a global variable in the codeunit. The codeunit is then executed as follows: Codeunit.SetStartValue(1); Codeunit.RUN; Hope that helps. /Bruno