Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / X++ Working with Exten...
Finance forum
Answered

X++ Working with Extended Forms

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 228,041 Super User 2024 Season 2 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.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,246 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,041 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans