Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Form Customization

Posted on by Microsoft Employee

Hi,

I have a requirement of Closing the form after button click in the action pane, if we  click the button it will open the Runbase batch processing dialog and if I click on "OK" or "cancel" button form is closing automatically since I have  added the code element.close() in clciked method.

My target is like form has to close only when we click on "OK" and to remain running if I click on "cancel "  button.

Categories:
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Form Customization

    Hi Nikolaos,

    I will change the code accordingly and check my scenario.

    Thanks!

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Form Customization

    The normal look&feel in the systems doesn't work like that. I recommend to consider sticking to the normal look&feel. This would mean that the caller form is not closed automatically if the user clicks OK on the batch dialog.

    However it's possible to achieve it.

    You need something like that in the main method of your RunBaseBatch class (usual disclaimer: this is an illustration only, not real code that you should expect to work in your scenario without changes):

    public static void (Args _args)
    {
        Object caller = _args.caller();
        FormRun callerForm;
        MyRunBaseClass myRunBaseClass = MyRunBaseClass::construct();
        
        if (caller is FormRun)
        {
            callerForm = _args.caller();
        }
        
        if (myRunBaseClass.prompt())
        {
            callerForm.close();
            myRunBaseClass.run();
        }
    }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans