Skip to main content

Notifications

Microsoft Dynamics AX forum

Enable change tracking on SalesOrderHeaderEntity

Posted on by 11,627

Hi All,

I have recently configured a new SQL Azure database and exported AX 7 entities as described in the link below:

https://blogs.msdn.microsoft.com/dynamicsaxbi/2016/07/27/export-dynamics-ax7-entities-to-your-own-azure-sql-database/#comment-1306

I am getting issues when trying to enable change tracking for SalesOrderHeaderEntity and SalesOrderLineEntity. The message says “Entity sales order is not supported for change tracking as it doesn’t have any primary index or alternate key “. But SalesOrderHeaderEntity does have SalesOrderNumber under Keys node of the data entity, it is referring to the SalesID field on SalesTable, which is an alternate key on SalesTable.

Does anyone have any clue why it is not working or is there anything we might be missing in configuration ?

Thanks,

Baber.

*This post is locked for comments

  • ASHISH ANAND Profile Picture
    ASHISH ANAND 165 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Hi Baber

    While using the custom entity to enable change tracking receiving error

    Relationship between [%1,%2 ] does not exist .

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    No worries. I think you are trying to make changes on SYS layer. Try to make change on USR, CUS or VAR layer and then you should be able to do that. Not sure why you are unable to open the link. You can open Issue search in LCS and put 3816049 in the search box and then you should be able to see the details.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    It seems like the forum breaks some posted links, after pasting the pieces together I was able to get a link to open, but got the error:

    Something went wrong

    Message

    Sorry, the current user does not have permission to access this resource.

    Error code

    PermissionDenied

    And yes, I was logged into LCS in that browser instance, so not sure what the problem was.

    It seems strange to me, this is very clearly a bug in Dynamics 365, but instead of simply fixing the bug, instead Microsoft goes in the opposite direction and deletes posts where a workaround was posted.  It seems like a strange strategy to me.

    As for the index, I tried making the change in AOT within Visual Studio (everything was disabled), as well as directly in the [AxDB] database while signed in as axlocaladmin (everything was also disabled).

    I am going to have to learn some fundamentals here first it seems.

    Thank you for helping me Baber, I've had a very long day today so I particularly appreciate it today!

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Hi,

    You just need to change these properties in existing index StagingIdx on staging table. I have made changes in StagingIdx table for PurchPurchaseOrderHeaderStaging table. The link worked for me and opened in LCS. If you have LCS login, you can login with your partner credentials and view the contents inside the link.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Thanks Baber,

    Unfortunately, your link above won't load for me; on my end, it resolves to the URL:  fix.lcs.dynamics.com/.../1199605;amp

    But that's ok, I think I understand the problem based on your description.

    On PurchPurchaseOrderHeaderStaging, I do see StagingIdx with settings AllowDuplicates=Yes and AlternateKey=No

    Unfortunately, even though I have System Administrator role, these properties seem to be read only.  I also am unable to add a new index by right clicking the indexes node (as I believe you are supposed to be able to do, based on something I read elsewhere).

    I've never changed anything in AOT before, I simply created a new Dynamics 365 for Operations project in Visual Studio and then opened the AOT window, perhaps there is a complete process I need to be going through?  Any hint you could offer would be greatly appreciated.

  • Suggested answer
    syed baber Profile Picture
    syed baber 11,627 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Hi ,

    Take at below IssueSearch link:

    fix.lcs.dynamics.com/.../1199605;qc=162dbbaa315c0cf367480a5bd4b7aacb7ab85800c616813419b2864a48691eb5

    It seems like Microsoft have removed the contents on the link I provided earlier. The above link mentioned the workaround to enable change tracking which is to create a unique index on Staging table. The PurchPurchaseOrderHeaderEntity has index StagingIdx which is not unique OOTB, so you need to set its AllowDuplicate property to NO and Alternate Key property to YES. This is what I did to make it work for all the entities where I need change tracking.

    Please let me know if you have further queries.

    Thanks,

    Baber.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Has anyone gotten this to work?  I am attempting to enable change tracking on Purchase orders (PurchPurchaseOrderHeaderEntity) and am getting the error:

    Entity Purchase orders is not supported for change tracking as it doesnt have any primary index or alternate key

    Entity Purchase orders is not supported for change tracking as it doesn't have any primary index or alternate key

    However, looking in AOT I see:

     AOT>DataModel>DataEntities>PurchPurchaseOrderHeaderEntity>Keys>EntityKey>PurchaseOrderNumber

    This being the HEADER table, PurchaseOrderNumber should in fact be unique, so what might be the problem here?

  • Dhillon Profile Picture
    Dhillon 215 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Hi Baber,

    What was the workaround?

    Thanks,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    The link does not work and I can't find the workaround.  Can you help....

  • Verified answer
    syed baber Profile Picture
    syed baber 11,627 on at
    RE: Enable change tracking on SalesOrderHeaderEntity

    Found this in Issue search with a workaround. Below is the link:

    fix.lcs.dynamics.com/.../NotFixed;qc=d771f0be8c0977b671f7d519dd7dd47c8593e662d7339a6defc0ea78b2bbef37

    Thanks,

    Baber.

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

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,802 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,133 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,154

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans