Merge two records from one table in AX 2009

In AX 2009, you can merge two records by using the merge() function in a table. For Example if you have posted a project with different department dimensions and now if you would like to merge two records of department dimension then this merge function can be helpful. The sample code is here as follows:

Dimensions dimensions1, dimensions2;
;
ttsbegin;
dimensions1 = Dimensions::find(Sysdimension::Department, ‘abc’);
dimensions2 = Dimensions::find(Sysdimension::Department, ‘def’);
dimensions1.merge(dimensions2); // Merge Department dimension ‘abc’ into ‘def’ department dimension
ttscommit;
Now all the transactions which has abc Department dimension will be changed to def in all the tables and Department Dimension ‘abc’ will be deleted from the dimension table.
So, Folks……………Now its pretty easy to merge two records…………

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Comments

  1. I think this is just what we are looking for but we are getting the following error. We want to Merge two existing Company Divisions (Our first Dimensions)…. any ideas?

    Cannot delete a record in Dimensions (Dimensions).
    The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause.

    (S)ClassesxRecordDelete
    (S)Data DictionaryTablesDimensionsMethodsDelete – line 80
    (S)ClassesxRecordmerge
    (C)ClassesFormButtonControlClicked – line 13