web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

X++ Working with Extended Forms

(0) ShareShare
ReportReport
Posted on by 75

In the main model we have a Dialog form.  I need to do a customization which adds fields to this Dialog form and return them to the main model.   I have the new fields in an extension of the main model's Dialog form.

My question is: I have put an event handler on the OK button but I am unable to reference the object from the main model's OK script.

Below is the call to open the Dialog form.   On the click of the Ok button I need the customization to update the overrideParameters object.

 Args args = new Args(formStr(TemplatesSelectionObject));
            args.parmObject(overrideParameters);
            FormRun formRun = classFactory.formRunClass(args);
            formRun.init();
            formRun.run();
            formRun.wait();
            formRun.detach();

The Ok button main model's click control:

 Args args = element.args();
 OverrideParametersClass overrideParameters = args.parmObject();
 
 // set the overrideParameters variable.

Customization has the event handler on the Ok button click.  It's called but I was hoping / expecting to be able to do something like  mainModelForm::overrideParameters.newAttribute = 'data';

Any suggestions or links will be greatly appreciated.

Thanks
Duane

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    240,361 Most Valuable Professional on at

    If I understand your description, what you want isn't possible.

    overrideParameters is a variable existing inside clicked() method only and it can't be access from any other method, including your event handler.

    But... maybe you can achieve your goal by modifying the value in args.parmObject().

    Or, if you have control over the main model, you may want to make it easier to extend.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
SajeedMullaji Profile Picture

SajeedMullaji 366

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 289 Super User 2026 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 260 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans