I am creating a new codeunit and I want to have a parameter pass over in the on Run function. For some reason it doesn't let me create a parameter; shall I do something apart from setting the paramaters from the view local?
I think you can only pass the OnRun trigger a single record parameter, you can set the TableNo property of the Codeunit to the record you need to pass. Have a look at Codeunit 80 for an example.
If you need to pass other parameters, I think you'll have to create a function within the codeunit and call that.
in the OnRun() you can only select an Table as Parameter.
If you need an other parametertype, like Integer, code, etc. you must create an other function (CallFunction) in this Codeunit. Then you must call the Callfunction() and then call the Run() Funktion.
Sample:
Your codeunit:
OnRun()
if VariableParameter = 123 then
.....
CallFunction(LocPara integer)
VariableParameter := LocPara;
The Call from form, table, other codeunit:
clear(Yourcodeunit);
YourCodeunit.CallFunction(MyIntegerParameterValueVariable)
Yourcodeunit.Run()
Comments
If you need to pass other parameters, I think you'll have to create a function within the codeunit and call that.
If you need an other parametertype, like Integer, code, etc. you must create an other function (CallFunction) in this Codeunit. Then you must call the Callfunction() and then call the Run() Funktion.
Sample:
Your codeunit:
Regards