Skip to main content

Notifications

Announcements

No record found.

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

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader 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.

  • 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

  • Suggested answer
    Iulian Cordobin Profile Picture
    8,201 on at
    RE: Calling job from button

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

  • 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.

  • 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.

  • Verified answer
    Sohaib Cheema Profile Picture
    46,614 User Group Leader 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.

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

    You should move your code to a class and call the 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,424 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,043 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans