Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 1 PlanDynamics 365 release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.
2022 release wave 1 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Has anyone managed to successfully configure AIF services for change tracking?
I have enabled both change tracking at a Database-level and at a Table-level (CustTable). This was carried out directly in SQL.
When I make a change to a Customer record in the AX client, I can query the SQL change-tables directly and view the changed records.
However, when I try the execute the getChangedKeys() operation on the CustCustomerServices from a .net client, the EntityKeyPage object has a PageStatus property set to 'Failure' and a PageStatusDetails property set to 'Change Tracking Disabled'.
Is there anything else I need to do to enable change tracking, is this configurable from within the AX client somewhere? The documentation (which seems fairly thin on the ground) seems to suggest that this only needs to be enabled on the database table.
I have been looking at Change Tracking for a couple weeks now, and finally today have successfully gotten it to work. The MSDN article does not help much at all, but with a little x++ knowledge and looking into the classes I found "AifChangeTrackingConfiguration". In order to be able to call the static methods on this class we must assert permissions from "AifChangeTrackingPermission".
Here is an example of what I used to get getChangedKeys() working for CustCustomerService:
server public static void main(Args _args)
// Run this first to globally enable changeTracking
// Here we are loading the query that the webservice uses (I took a wild guess to figure this out)
_query = new Query("AxdCustomer");
_changeTracking = AifChangeTracking::construct(_query);
// Did we enable change tracking?
info(_changeTracking.isChangeTrackingEnabled()? "true" : "false");
// did we enable change tracking for this specific query?
info(_changeTracking.isChangeTrackingEnabledForQuery()? "q:true" : "q:false");
// redundant check... but anyways its checking if the specific table has change tracking enabled
info(_changeTracking.isChangeTrackingEnabledForTable(tableNum(CustTable))? "t:true" : "t:false");
// Revert the permission assert
Based on your answer, I have managed to get this working. The information was excellent, many thanks!
I am however still trying to fully get to grips with the functionality. A couple of observations;
Changes in child tables are currently not propagating into the parent change-tables. i.e. if I make a change to the Party name, I can't see the changes when I query the CustTable. At the moment I'm not sure if this is possible or not?
Also, I can only query the change-tables with a date no earlier than three days in the past. i.e. if I supply the getChangedKeys() method with a date similar to 'DateTime.Now.AddDays(-4)'. The query fails with a status 'change date out of range'. This is slightly unexpected behaviour.
Anyway, thanks again for your reply. It was very helpful.
I'm not exactly sure how the parent-child table relationship works with change tracking. I know you can peek at what tables AX has change tracking enabled in the "AIFSQLCDCENABLEDTABLES" table, and I noticed some of the party tables are in there so it gives me some hope but I don't have an answer for this one. If you or someone else comes across this I would like to know as well.
The data retention period for the change tracking methods (i.e. getChangedKeys) can be changed by opening up SQL Server Management Studio and going to the properties of the database, then Change Tracking. There you can set the "Retention Period" to something more appropriate for your needs. You can even make it smaller into Hours or Minutes if needed.
Followed the steps mentioned in this post, and was able to use
getchangedkeys method of other document services like Vendor, Transfer
Order. But to send purchase id's i would like to use the
getchangedkeys Purchase Requisition Service of AX 2012.
The main method errors out for Purchase Requisition Service. Replaced [Query: AxdPurchaseRequistion and Table: VendPurchOrderJour] these two values in the main method.
The error is because PURCHTABLEARCHIVEDVERSIONS is a View in AX and this is not available at database level. Is there any way to make this work for Purchase Order Document Service?
SQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]The object 'dbo.PURCHTABLEARCHIVEDVERSIONS' does not exist or is invalid for this operation.
SQL statement: CREATE TRIGGER AIFTestScopeAxdPurchaseRequisitionPurchTableAllVersionsAfterDelete75e10f64c2414901901c59aa30bfa490 ON dbo.PURCHTABLEARCHIVEDVERSIONS AFTER DELETEASBEGIN SET NOCOUNT ON; update VENDPURCHORDERJOUR set VENDPURCHORDERJOUR.RECID = VENDPURCHORDERJOUR.RECID from VENDPURCHORDERJOUR cross join DELETED where DELETED.PURCHTABLEVERSIONRECID = VENDPURCHORDERJOUR.PURCHTABLEVERSION END
Not sure if there's a better way, but you could always re-create the document service by reconstructing the underlying query using the actual tables rather than the views? Bit long-winded mind...
request you to provide sample XML which can be sent as an Inbound file with getChangedKeys operation.
Captured this through a WCF tracing tool for the getChangedKeys request to AX.
Hope this can help you..
<h:CallContext xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../datacontracts" xmlns:h="schemas.microsoft.com/.../datacontracts">
<s:Body xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance">
Hope your are doing good!!!
I am replying to a quite old link, I am facing the issue in using "getChangedKeys()" operation from .net, if you have the sample code snippet, it would be helpful.
Thanks in advance.
Prasad, if you want to discuss your problem, please create a new thread and give us a more detailed description than just "I am facing the issue".
You can't expect us to read your mind and give you exactly the piece of code you need to solve your particular issue (if it can be solved by a piece of code at all).
Business Applications communities