Is it possible to call a job in a job?
Example:
In the AOT/Jobs I have created a Job1 and a Job2.
Now I want to create a JobMain and in this job I want to call/run Job1 and Job2.
Does anyone have any suggestions?
Thanks for bringing this to my attention. You are right.
MenuItemType (system enum that can be found under AOT -> System Documentation -> Enums) has three elements viz., Display, Output and Action.
And in my last post, I just mentioned the syntax as -
MenuFunction mibuso = new MenuFunction ("<Name of job>", type);
mibuso.run();
which is wrong. It should actually read as -
MenuFunction mi = new MenuFunction('Job9',MenuItemType::Action);
mi.run();
Where 'Job9' is an Action type menu item. In this particular menu item, in class property, 'job' should be selected. And under 'Object' property, the appropriate job should be selected.
Comments
Just a suggestion - please don't use jobs in such a manner. Instead use class. Jobs are meant for temporary tasks.
But coming to your query, you can use menuitem for calling jobs. I don't have Axapta in front of me. But it goes something like this -
MenuFunction mibuso = new MenuFunction ("<Name of job>", type);
mibuso.run();
HTH,
Harish Mohanbabu
Long way to go before I sleep..
The MenuFunction can only be used to execute the MenuItem type such as Action, Output and Display, and it can't be use to call jobs.
Please correct me if i'm wrong.
Regards,
Terabyte
Thanks for bringing this to my attention. You are right.
MenuItemType (system enum that can be found under AOT -> System Documentation -> Enums) has three elements viz., Display, Output and Action.
And in my last post, I just mentioned the syntax as -
MenuFunction mibuso = new MenuFunction ("<Name of job>", type);
mibuso.run();
which is wrong. It should actually read as -
MenuFunction mi = new MenuFunction('Job9',MenuItemType::Action);
mi.run();
Where 'Job9' is an Action type menu item. In this particular menu item, in class property, 'job' should be selected. And under 'Object' property, the appropriate job should be selected.
Apologies for my earlier post.
Regards,
Harish Mohanbabu
Long way to go before I sleep..
MainJob()
{
TreeNode treeNode = TreeNode::findNode('Jobs') ;
TreeNode tempNode;
;
tempNode = treeNode.AOTfindChild('Job1');
tempNode.AOTrun();
tempNode = treeNode.AOTfindChild('Job2');
tempNode.AOTrun();
treeNode.treeNodeRelease;
treeNode = NULL;
}
Subbu