When trying to add a parameter in the onrun function of a codeunit in design it is not possible.
But when it is wanted to have a parameter you can export the object in txt format,
add in the properties section just before the onrun section the parameter and import it again.
(look at "<-- this is the parameter" in the codesnippet)
So far I've only tested it with a record as a variable. The correct syntax for other datatypes is so far unkown to me.
OBJECT Codeunit 50000 test
{
OBJECT-PROPERTIES
{
Date=25/05/09;
Time=[10:31:00];
Modified=No;
Version List=;
}
PROPERTIES
{
TableNo=36; <- this is the parameter (in this case table sales header)
OnRun=BEGIN
END;
}
Answers
RIS Plus, LLC
MVP - Business Apps
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
As DenSter quoted, you only can use a record as parameter. For special needs you can use one of these methods:
- Create a special record only for the parameters
- Before calling the run method calling a user defined function (called setParams for example) to set one or more global variables of the the codeunit. These globals can be used afterwords. Of course the globals will be reset if the variable of the codeunit goes out of scope.
Hope this helps
Thomas
I guess I've been a little bit to optimistic (or pessimistic, depends how you look at it)
|To-Increase|
Even if you had found something that the NAV PG missed, would you really want to use an unsupported feature like this in a live environment?
RIS Plus, LLC
MVP - Business Apps