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)

ParmObject to drop dialog

(0) ShareShare
ReportReport
Posted on by 237,965 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

I have the same question (0)
  • Beat Profile Picture
    1,006 on at

    Hi Martin,

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

    br

    Beat

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

    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
    1,006 on at

    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

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