Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Technical: How to copy a table from one legal entity to other legal entity.

(0) ShareShare
ReportReport
Posted on by 120

Hi All,

Need your inputs in designing and building this functionality.

I want to copy data from a table for e.g RetailDiscountCode in one legal entity to another legal entity. Data for a particular record will be selected in source legal entity , in the target legal entity, need to check if similar data exists in the table. Based on check, action will result in either create,update or delete.

Can this be done in generic way , so that any table can be passed as parameter and data for that table can be copied?

I have looked at DictTable, DictField, but not sure, how to identify unique record on a table and match in a generic function.

Please suggest.

Thanks.

*This post is locked for comments

  • MSKAX Profile Picture
    MSKAX 120 on at
    RE: Technical: How to copy a table from one legal entity to other legal entity.

    Thanks Ievgen.

    As ever, your inputs have been very valuable, helped to decide and move on.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Technical: How to copy a table from one legal entity to other legal entity.

    Ultimately generic method for your task is not possible because some tables do not have unique index except RecId because allow all fields to be repeated and you have to define what means unique in this case somehow.

    For other table you can use any unique index for you search if primary is recid. You can find it using dictIndex as well.

  • MSKAX Profile Picture
    MSKAX 120 on at
    RE: Technical: How to copy a table from one legal entity to other legal entity.

    Hi Ievgen,

    Thanks for your inputs and the link.

    A follow up question here, this would help decide on the possibility to code this generic function.

    Using dictTable.primaryIndex() as in job from above link identifies and returns RecId as primary key on e.g table RetailDiscountCode.

    However, when I switch company and trying to find record in the table, the RecId is not available. I should use OfferId to match and take action on unique record.

    Does this mean, a generic method is not possible? Identifying unique record should be handled case by case based on the table? pls confirm.

    Thanks.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Technical: How to copy a table from one legal entity to other legal entity.

    You can use dictindex to get fields from primary index community.dynamics.com/.../reflection-code-to-iterate-on-the-primary-index-of-the-table then select record base on these fields.

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! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans