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 :
Microsoft Dynamics AX (Archived)

Need you help about how to check Batch Processing in Sysoperation on AX 2012

(0) ShareShare
ReportReport
Posted on by

AXOperation1.png

Que#1: How to add button control and call back function when user click in the General tab as picture above?

Que#2: How to check whether the "Batch Processing" is checked or not in the code in SysEntryPointAttribute function

AXOperation.png

[SysEntryPointAttribute]
public void saleAndMargin(HPGExportToCSVServiceContract _hpgExportToCSVServiceContract)
{

// Check whether is it run via Batch or manually

}

Que#3: Is there any way to check whether it is run via Batch Processing or not in the function call in [SysEntryPointAttribute] function

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    For Que#2, I think I got the answer as code below in the class that extends SysOperationServiceController    

    batchInfo = TestServiceController.batchInfo();

    checkBatchRun = batchInfo.fieldBatchExecuteValue();

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Regarding your first question, you can modify UI through UI builders. Please look into a SysOperation tutorial to understand the basics; repeating it here wouldn't be efficient.

    Nevertheless using buttons there would be highly unusual; consider using input controls instead.

  • Suggested answer
    5400 Profile Picture
    7,162 on at

    1. you have to extends DataContractUIBuilder to customized your dialog.

    Exm:\Classes\CustTransOpenPerDateUIBuilder

    3. There is in build function called isInBatch().

    Hope it will help you to proceed.

    Thanks

    Bhaskar

  • Community Member Profile Picture
    on at

    As I have tested, UI Builder can use what Contract create, but I cound not find button type that Contract class can create, please advice

  • Community Member Profile Picture
    on at

    For isInBatch(), I can get it from ServiceController class,

    The question is how to pass this value to Contract class to be used in call function when batch job was called

    public static void main(Args _args)

    {

       XXXServiceController xxxServiceController;

       BatchInfo batchInfo;

       XXXServiceContract         xxxServiceContract;

       ;

       XXXServiceController = xxxServiceController::newFromArgs(_args);

       XXXServiceController.startOperation();

       xxxServiceContract =xxxServiceController.getDataContractObject('_xxxServiceContract');

       batchInfo = xxxServiceController.batchInfo();

       xxxServiceContract.setBatchProcessing(batchInfo.fieldBatchExecuteValue());

    }

    Please review the code above, It's doesn't work

    When Batch Job was called, the batchInfo.fieldBatchExecuteValue() is "false" instead of "True"

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Your code doesn't make any sense to me - what are you trying to achieve by that?

    Regarding the UI builder, it's used for building a form at runtime, therefore you can do a lot there. Nevertheless please tell us why you want to add a button there.

    Man, discussing several different topics in a single thread is so confusing - please create a separate thread for each topic next time.

  • 5400 Profile Picture
    7,162 on at

    The UI builder class is actually an optional class for the SysOperation framework, which kind of acts as the view part of the pattern. You should only use it if you want to add some extra behavior to the dialog that AX constructs dynamically for you. If you are perfectly happy with the dialog AX shows you when you run your operation, you shouldn't worry about this class. To create a UI Builder, you should extend the SysOperationAutomaticUIBuilder class. It will provide you a set of methods to work with the dialog's design, but we usually add extra behavior or customize a lookup inside the postBuild method.

    Wht type of buttton you want to add and why? can you give some details.

    Thanks

    Bhaskar

  • Community Member Profile Picture
    on at

    Let me summarized for 3 questions below:

    Que#1: How to add button control and call back function when user click in the General tab as picture above?  In UI Builder is just can manage UI but could not created the new one that not exist in Contract class. I tried to search in google but noone can add button in the dialog, it's difference with RunBaseBatch, I can create button via RunBaseBatch.

    Please advice how to add button control in Contract class?

    Why I need to add the button, because I need to do some actions when user click in the button such as see query results from current input before run batch, etc.

    Que#2 and #3: How to check whether the "Batch Processing" is checked or not in the code.

    In Controller class, I can know but how to use this value in the execution function in Service class when batch job was called in queue. There are difference code between run batch job via manually and autorun on server.

    Please help on this, seem less people to know this

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Q1: Contract classes represent data, not UI such as buttons. Your description of the purpose is not clear - maybe you should use a query in your data contract, maybe you need another form before actually triggering your build, who knows.

    Q2: Consider Session::isServer(), for example, depending on what *exactly* you're trying to achieve. Don't forget that SysOperation framework supports four execution modes, not just two.

  • Community Member Profile Picture
    on at

    Thank a lot for Q2, let me try it :)

    For Q1: as ref below

    www.artofcreation.be/.../comment-page-1

    For example in Contract class:

    ///////////////////////////////////////////////////////////////////////

    [DataMemberAttribute

    ,SysOperationLabelAttribute(literalStr("@SYS11284"))] // today's date

    public TransDate parmTransDate(TransDate _transDate = transDate)

    {

       transDate = _transDate;

       return transDate;

    }

    ////////////////////////////////////////////////////////////////////////

    The TransDate control will be in dialog,

    I have tried to add Button like add TransDate in this class but could not. When I try to add button in UI Builder, it's show error that not exist in Contract.

    That why I focus on Contract class, please advice

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans