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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to run runnable class from Action menu item

(0) ShareShare
ReportReport
Posted on by 198

Hi there, i had created a class which has logic to populate the Sales Order status in my newly created table.   The class has to run as a batch job and for that i created Action menu item and added object as myClassName. I had added the action menu item in the required menu and tried to run the batch from front end. But from here am getting error like 'object reference not set to instance ' error. I tried to debug from Visual Studio and the batch was working fine but when am tring to call from front end it was throwing the error.  Please find the action menu item properties from the screenshot attached and please let me know the corrections so that i can run  batch job from Action menu item after adding it to front end (Menu).  Thanks in advance.

Here Class Name is : HamMagentoOnlineOrderStatusService.      This class has main method added within it.

3513.PNG6237.PNG

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi premK6969,

    How do you run your action menu items from UI? Have you added it to the main menu? Do you see the dialog or it's just failing when you try to open it? Is it runbase or sysOperation operation?

  • premK6969 Profile Picture
    198 on at

    Hi Sergei, i had added my class to Action menu item and added it to Main Menu as per business requirement. Do we need to extend our class to runbase or am not sure since am new to batch jobs. While openings the added action menu item it was throwing message like object reference not set to instance. But the same i can able to run from Visual Studio.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi premK6969,

    Could you, please, share your main method?

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi premK6969,

    By the way, you can use the "Attach to process" option for debugging start for the main menu case.

    microsoftdynamix.blogspot.com/.../d365fo-debugging.html (the process you are interested could be w3wp.exe or iisexpress.exe)

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Hi,

    Your menu item settings look correct. So, your classes main method is called. Could you please share your code? That helps us notice what's the problem with it. Thanks!

    By the way, if you want your class to be runnable as a batch job, you need to use SysOperation or RunBase framework. 

  • premK6969 Profile Picture
    198 on at

    Hi Nikolaos,  i have a code in my class with main method. Can u let me the process how to make it as runnable class.  Please let me know the steps to make it as runnable class and add the menu item in  Under System Administration>Periodic setup.  Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    "Runnable class" is a class that has a main method. So if you have a main method, it's already a runnable class.

    You can add your menu item in System administration - Periodic by creating a Menu extension and adding your menu item to the extension.

  • Community Member Profile Picture
    on at

    Hi premK6969

    I think you are not clear with your requirement.

    1. There are two types of templates present in D365 as shown in below :

    pastedimage1602148031269v1.png

    So either you created a class OR you created a runnable class ( A job basically).

    2. A runnable class(job) object already has main method by default. and in a class you need to create an entry point.

    3. In class you can extend it from runbase or sysoperation framework but that is not in case of runnable class.

    As per my understanding if you want to run your logic it is better you can create a class and extend it with runbase or sysoperation as per your requirement.

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Hi premK6969,

    could you give us an update on the status of this issue? Are you still having some problems?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans