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)

Change another form design by form/table method

(1) ShareShare
ReportReport
Posted on by

Hi all,

I have a question about change the form design by code.

I have table A and B and corresponding form A and B. The requirement is when I add a record in table A,

(1)table B will add a related column (not a record) automatically

(2) a new related field/column will add in the design of form B by programingly.

Form A

Column1   Column2 

1                   A

2                   B

3                   C            <-- Newly add record

After the record added, I want           

Table B                

A           B           C      <--Add column C automatically 

...           ...           ...

....          ...           ...

Form B

A          B            C     <-- Add this column in design automatically

...         ...            ...

...         ...            ...

The first problem has been solved.

I override the insert() method in table A so that when it add a new record, the method will trigger and AOT will add the column in table B.  Refer to http://dynamicsuser.net/ax/f/11/t/37822;

But the second one seems too hard for me. Anyone has an idea? Thank you very much!

*This post is locked for comments

I have the same question (0)
  • Vilmos Kintera Profile Picture
    46,149 on at

    You can find how to add runtime controls to a form here:

    AOT > Forms > tutorial_Form_AddControl

    I am unsure what do you mean by related field, you have to bind the FormControl to a table and field datasource by setting it's properties and that's it. The table must also exist as a datasource on the form.

  • Community Member Profile Picture
    on at

    Hi Vilmos,

    Thank you for your reply, but I wonder how to call FormB.design() in FormA/Table A method? I saw most example will handle the form design in its own method, my situation is a bit special. Thx~

  • Mea_ Profile Picture
    60,284 on at

    Usually you don't modify one form from another form in AX.

    As you said you have tables behind these forms and you are able to add new column to table B, so all you need is to write a logic on Form B to draw new column on the form when new column on the table is created.

  • Vilmos Kintera Profile Picture
    46,149 on at

    If you open FormB from FormA and you pass in TableA as a record context, you could fire the LinkActive datasource method on FormB if the cursor moves on TableA, where you could do your add control and field binding.

    I hope this points you to the right direction to figure it out.

    Another thing, if you are not using table records and grid, but maybe a Table control instead, you could manipulate the columns and rows in there yourself, however that does require a lot more coding for sure.

  • Community Member Profile Picture
    on at

    Thank you ievgen!

    I am just considering how to do this. Is there any thing will trigger in the form B when a new column in added in the related table, so I can get the attribute of the newly added column and update the design of the form?

  • Mea_ Profile Picture
    60,284 on at

    No, there is no such event and again it's a bad idea because you always can open 2 forms independently so you won't be able to find one form from another one.

    You have init() method where you can check your table on form open.

    You have active() method as well.  So you can redraw your columns when record get activated.

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