web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

  • Community Member Profile Picture
    on at
    RE: Calling job from button

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

  • Verified answer
    Sohaib Cheema Profile Picture
    on at
    RE: Calling job from button

    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
    RE: Calling job from button

    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
    RE: Calling job from button

    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
    on at
    RE: Calling job from button

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

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Calling job from button

    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
    on at
    RE: Calling job from button

    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

Responsible AI policies

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

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans