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, ...
Answered

How to use Controller Class extending SysOperationServiceController Class for Batch Job

(0) ShareShare
ReportReport
Posted on by 185

I have three different Controller Class which extends SysOperationServiceController Class, In how many ways I can create the batch job , I followed the following article https://dynamicsaxinsight.wordpress.com/2015/04/24/ax-2012-customize-controller-for-batch-job/ But I am finding the following error.

SysOperSerClassError.png

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    If you followed the article, your controller class should have a main method. But the error says that your class doesn't have a main method. Please start by checking this.

    If you need more help, please share the source code of your controller class.

    Also, please describe the process that leads to the error message that we see in your screenshot.

  • bilal170795 Profile Picture
    185 on at

    is this article is useful for me?

    community.dynamics.com/.../634239

  • bilal170795 Profile Picture
    185 on at

    Also here is my code

    ReportControllerBatchJob.png

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    I don't know. You have to determine if it's useful for you.

    Especially without seeing your code there's not much we can do.

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Thanks for sharing your code.

    However we can't even see what class it is so it's not very useful. Could you please ready my first reply again and provide the information that I asked? Thanks!

    However we can see from the code that you are trying to initialize a batch job in code. Is there some particular reason for it? Normally users set up batch jobs via the user interface unless there's some special requirement. Do you have some special requirement? Could you tell us what you are trying to do?

  • bilal170795 Profile Picture
    185 on at

    In class declaration my class name is SrsReportRunRdpPreProcessController which extends sysOperationServiceController class only and there is no declaration or code.

  • bilal170795 Profile Picture
    185 on at

    Actually some of the batch jobs were deleted accidentally but the classe were known so i have to make the batch jobs again, the problem is that when i am creating the batch job via interface i am unable to see my class when making the task, so i am using action menu item to create the batch job.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    So this is a standard class and not anything you developed? It would have been great if you had mentioned it earlier. Your question was very generic, but as it turns out your are dealing with a very specific problem. It always makes sense to share as much information as possible already in your first post, this way you can save a lot of your time (and others') and improve the chances of getting your question answered.

    Also, already in my first reply I asked you to check if your code has main method. So, it's also good to pay a lot of attention to what others write.

    Anyway, you might know that only classes that have Main method can be launched via an action menu item. This class doesn't have main method so you can't launch it via a menu item.

    But if you look at cross references, you will find how this batch is initialized by Classes\SysCheckListItem_SysParameters:

    Here's the code that you can use:

    SrsReportRunRdpPreProcessController::createCleanUpBatchJob();

    So, if you create a new class that has a main method and put this piece of code in the main method, then you can point your menu item to your new class and set up this batch.

  • bilal170795 Profile Picture
    185 on at

    Hi Nikaloas,

    Thanks a lot for your time and for your valuable words.

    The code works, I simply used it in a Job.

    Also I have another class ProdReceiptFinalizationController, how will I use it to make batch job.

    /// <summary>

    /// The <c>ProdReceiptFinalizationController</c> class extends the <c>SysOperationServiceController</c> class

    /// and is responsible for generating the metadata for the product receipt finalization request for the

    /// <c>ProdReceiptFinalizationOperation</c> journalization batch tasks creation operation and its execution.

    /// </summary>

    public class ProdReceiptFinalizationController extends SysOperationServiceController

    {

       public boolean canGoBatch()

       {

          return false;

       }

       protected ClassDescription defaultCaption()

       {

          return "@SYS4000653";

       }

    }

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

    As you notice, this class has a method called canGoBatch and it returns false. This means that the class can't be set up in batch.

    You can modify it to return true but perhaps it will not work correctly. There is some reason why Microsoft set it to not be possible to run in batch.

    If you look at the documentation of this class it says that it's supposed to be called from another process.

    Why would you like to run it in batch?

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans