Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

X++ Working with Extended Forms

(0) ShareShare
ReportReport
Posted on by 65

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

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    RE: X++ Working with Extended Forms

    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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans