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)

DMF/DIXF: How to include MCRCustTable in Customer entity

(0) ShareShare
ReportReport
Posted on by 847

I'm importing customers using DMF (a.k.a. DIXF).  I need to include MCRCustTable in the import process, but I have been unsuccessful.

MCRCustTable is related to CustTable by CustTable.RecId == MCRCustTable.CustTable.

I tried creating a custom entity based on the MCRCustTable​​​​, with a "generate" method to lookup the CustTable.RecId.  The problem I ran into with this method is that it creates the first record, and then updates the target on subsequent source records.  For example, when importing two records with customer ID 1 and 2, it creates the record with customer ID 1, then changes the customer ID to 2, and I end up with one record instead of two.

I also tried adding the MCRCustTable to the DMFCustomerTargetEntity (with the default relation).  That results in the first record importing with a value of zero in the CustTable field and the rest hitting an error: "Cannot create a record in Customers (MCRCustTable). Reference: 0, lha. The record already exists."

Does anyone have any suggestions on how to make this work?

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ajit Profile Picture
    8,755 on at

    Make sure 'addStagingLink' method of your custom entity also has a reference of your new table.

  • Suggested answer
    Khushhal Garg Profile Picture
    1,514 on at

    In your custom entity, what is the entity key. It should be Customer ID. Also, did you add CustTable column from MCRCustTable  in data entity fields?

  • Daniel Zook Profile Picture
    847 on at

    Thanks for the reply Khushal.  Unfortunately, I'm still a newbie and I don't understand what you mean by "entity key".  I'm doing some research to see if I can figure it out.  If you are referring to the index on the DMFMCRCustTableEntity table (staging), then yes, the AccountNum field is included in the index.

    I'm assuming the "data entity fields" you are referring to are in the DMFMCRCustTableTargetEntity query.  The CustTable column is included in the query fields.

  • Daniel Zook Profile Picture
    847 on at

    Thanks for the reply Ajit.  I can override that method on the DMFMCRCustTableEntityClass class, but I don't know what to do with it.  Since it receives a query and returns a query, I'm assuming it is used to modify the query for the entity.  Should I add CustTable to the query with a join to the MCRTable where MCRTable.CustTable == CustTable.RecId?

  • Suggested answer
    Ajit Profile Picture
    8,755 on at

    Yes adding that should work.

  • Suggested answer
    Ajit Profile Picture
    8,755 on at

    Entity Key is nothing but primary index but that is something in D365 not in AX 2012.

  • Daniel Zook Profile Picture
    847 on at

    Thanks.  I'll work on that next week and update this forum post.

  • Daniel Zook Profile Picture
    847 on at

    I appreciate the advice, but so far I haven't been able to make it work yet.

    Here is what I have so far...

    1. A custom entity created using the wizard

    pastedimage1567167968242v2.png

    2. Override of method addStagingLink

    pastedimage1567167945907v1.png

    3. Stage to target mapping

    pastedimage1567168018248v3.png

    4. Source to stage mapping

    pastedimage1567168052165v4.png

    Should I add a method to lookup the CustTable.RecId from the entity AccountNum field?

  • Daniel Zook Profile Picture
    847 on at

    I forgot to mention what happens when I run the import....

    The Execution History shows no errors, 2 records created in staging (which is correct) and 2 records updated in target (which is incorrect).  Basically, it is updating existing records (even though they don't match the account number), instead of adding new records to the MCRCustTable table.

  • Suggested answer
    Daniel Zook Profile Picture
    847 on at

    I added the generate method and mapped it from the staging table AccountNum field to the CustTable field in the target, and so far it appears to be working.  So it takes a combination of the generate method and the addStagingLink method.

    I'll do some more testing to confirm that all is well and update this post to confirm that this is the correct answer.

    Thanks again for all your help!

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