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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Calling job from button

(0) ShareShare
ReportReport
Posted on by

Hey all,

I have a requirement that i need to call a job from a button from.. let's say vendor form. I already have the job created. Now, i don't know how to implement this job to be called from a form's button. If there's a tutorial about this i hope you can put the link below on the comment box or if anyone have any kind of solution for this.

Thanks.

Anisa.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    You should move your code to a class and call the class.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    You can use two ways for that

    1. Call by Action menu item.

      Create an action menu item referring to your job and then call you action menu item

       

      MenuFunction menuFunction;
      
      menuFunction = new MenuFunction(menuItemActionStr(NameofYourActionMenu), MenuItemType::Action);
      menuFunction.run();

    2. Call by X++

       

       

      Note: above both ways are not recommended. Consider migrating your code into a class.

  • Verified answer
    Community Member Profile Picture
    on at

    You can attach this job to an action menu item and map it to a menuitem button in the form. You will have to initialize the caller from _args object in job.

    Jens above said it correctly, You should be implementing your code in a class not a job.

  • Community Member Profile Picture
    on at

    Thanks all, i've tried assign my job to action menu item, and put it on my form's button group. Why should i move my code to a class? if i already move it to a class, how can i call it? I mean, i call it from where? All of you just saying i should move my job to a class, but didn't explain how to call it, is it from form's control? Where, and how? Thanks.

  • Suggested answer
    Iulian Cordobin Profile Picture
    8,201 on at

    You should be reading this: msdn.microsoft.com/.../aa631180.aspx and msdn.microsoft.com/.../aa673265.aspx.

  • Suggested answer
    Community Member Profile Picture
    on at

    Anisa

    You can call a class just like how you did for the job. Everyone told you about moving code from job to a class because, jobs are usually written in ax to test or verify a logic before you actually implement it.

    A job may be overwritten by some one who is working in the same environment. A class on the other hand everyone knows is an implemented logic for some functionality. They won't bother to change it or overwrite it with new one.

    refer this link for learning more about classes : msdn.microsoft.com/.../aa868834.aspx

    calling a class from form button : msdn.microsoft.com/.../aa879186.aspx

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    going back to basics of OOP

    1) enter by main method, of class

    2) initialize by creation of object of class.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans