Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

How to use Controller Class extending SysOperationServiceController Class for Batch Job

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

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    Because previously it existed in the batch.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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?

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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";

       }

    }

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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.

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

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

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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?

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    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.

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    Also here is my code

    ReportControllerBatchJob.png

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How to use Controller Class extending SysOperationServiceController Class for Batch Job

    is this article is useful for me?

    community.dynamics.com/.../634239

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans