web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Can we call a X++ job in some class method in Ax 2012?

(0) ShareShare
ReportReport
Posted on by

Suppose i write some job somewhere then can I call it in some class method?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi Mahesh

    Try with :

    TreeNode                        Job;

    Job = treeNode::findNode(@"\Jobs\Denis");

    Job.AOTrun();

  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi Mahesh.

    I would recommend moving your job into a class's main method if possible.

    Alternately you can create a new MenuItem with ObjectType of "job" and then select your jon in the "Object" property. You can then execute the menu-item

    MenuFunction menuFunction;

    menuFunction = new MenuFunction(menuItemActionStr(MyMenuItem), MenuItemType::Action);

    menuFunction.run();

  • Community Member Profile Picture
    on at

    Thanks for your replies. I will check.

  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Just because you can doesn't mean you should...

    Jobs are intended for  small, self-contained pieces of code during development (e.g. when you want to quickly try something) and shipping any jobs at all with your solution isn't a good practice. If you need to call a job from a class, it's obvious that the code should be moved from the job.

    If you don't have any suitable class for your piece of code, create a new one, even if it had a single method only.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans