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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

passing the data from one table to another table

(0) ShareShare
ReportReport
Posted on by

hi ,,

when i create the new record it gets updated in main table.. when the new record is created in maintable it also need to be created in related table ..can any one help me with examples

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahmoud Hakim Profile Picture
    17,887 on at
  • Community Member Profile Picture
    on at

    hello mahmoud,

    actually records need to be reflected in the new record ...in ax

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    I feel this can be achieved through one of the following ways.

    i. One way is to make use of table inheritance (as suggested by Crispin).

    Refer below links:

    (Table Inheritance Overview [AX 2012])
    https://msdn.microsoft.com/en-us/library/gg881053.aspx

    (Walkthrough: Creating Base and Derived Tables [AX 2012])

    https://msdn.microsoft.com/en-us/library/gg844024.aspx

    (When to Use Table Inheritance [AX 2012])

    https://msdn.microsoft.com/en-us/library/gg843731.aspx

    ii. Another way is to create a posteventhandler to the insert method of tableA and fill in the details of tableB from tableA.

    Typically your code looks like below.
    Path: \Data Dictionary\Tables\TableA\Methods\insert\PostEventHandler

    public static void postinsertEventHandler(XppPrePostArgs _args)
    {
    TableA tableA = _args.getThis();
    TableB tableB;

    tableB = TableB::find();

    if (tableB.recid == 0)
    {
    tableB.Field1 = tableA.Field1;
    tableB.Field1 = tableA.Field1;
    }
    }

    Refer links:
    (How to use Event Handler in Microsoft Dynamics AX 2012:)
    https://chaituax.wordpress.com/2014/04/09/how-to-use-event-handler-in-microsoft-dynamics-ax-2012/

    (Event Handling in Microsoft Dynamics AX 2012)

    https://community.dynamics.com/gp/b/erpsoftwareblog/archive/2012/06/25/event-handling-in-microsoft-dynamics-ax-2012

    iii. Same code can be written in the insert method of TableA after super()

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans