Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

ParmObject to drop dialog

Posted on by 229,918 Most Valuable Professional

I have a drop dialog form and I need to pass an object into it from the caller form. To set parmObject, I usually use an override of clicked() similar to this:

void clicked()
{
    Args args = new Args();

    args.caller(element);
    args.parmObject(someObject);
    args.record(someTable);

    this.menuFunction().run(args);
}

It works well for normal menu item buttons, but not for drop dialogs, because MenuFunction.run() isn't aware of that I want to open the form as a drop dialog.

To solve this problem, I would need either to find a correct way of opening drop dialogs from code, or to set parmObject() without overriding clicked() of the DropDialogButton.

I will be surprised if it can be done, but if it is, it will be useful to learn.

I surely can use a workaround, such as exposing the object by a method on the caller form, but the resulting form is uglier and more tightly coupled with a particular caller form than if I just get an object and check its type.

*This post is locked for comments

  • Beat Profile Picture
    Beat 1,006 on at
    RE: ParmObject to drop dialog

    Ok - tnx!

    I decided to use the caller to provide the parameter object - even there is the possibility to use this.parameters() in clicked event to provide a string to the dialog's args.parm() property. I prefere to have the object instance then to serialize and deserialize it.

    br

    Beat

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 229,918 Most Valuable Professional on at
    RE: ParmObject to drop dialog

    No; it seems that I was right in assuming that it can't be done directly.

    I used the workaround mentioned at the end of my post. This is (roughly) what I do in init() of the dialog form:

    Object caller = element.args().caller() as FormRun;
    
    if (caller && formHasMethod(caller, identifierStr(getMyObject)))
    {
        myObject = caller.getMyObject();
    }
  • Beat Profile Picture
    Beat 1,006 on at
    RE: ParmObject to drop dialog

    Hi Martin,

    I have the same requirement - did you got a solution?

    br

    Beat

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans