Search through blog..

Saturday, April 8, 2017

Issue resolved - Unsynced records from Retail store to AX DB (P-0001 job)

Sometimes even though we work with the same Dynamics AX product and architecture, we encounter some issues which could be tricky to solve. I had a similar issue with Retail architecture.


The issue was that one Store out of 100+ live stores stopped syncing the data between CDB and AX Database. The P-0001 job was unable to sync the transactions from CDB of one particular store to the AX database. Whereas at the same time, all the 9999 jobs (sync from AX --> CDB) were working fine and also the P-0001 job (sync from CDB-->AX) for all remaining store was working fine. Dynamics AX version was AX 2012 R3 CU8.


When I check the Event Viewer in the Channel Database server of that store, I see the below error message:


Exception when converting job defination to request header. Error Details: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Retail.SynchClient.Core.UploadAgent.CalculateFilterMinValue(Int64 rerunUploadSessionId, String tableName, String fieldName)
   at Microsoft.Dynamics.Retail.SynchClient.Core.UploadAgent.ConvertJobDefinitionToRequestHeader(Int64 rerunUploadSessionId, Job activeJob, SessionManager sessionMgr)System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Retail.SynchClient.Core.UploadAgent.CalculateFilterMinValue(Int64 rerunUploadSessionId, String tableName, String fieldName)
   at Microsoft.Dynamics.Retail.SynchClient.Core.UploadAgent.ConvertJobDefinitionToRequestHeader(Int64 rerunUploadSessionId, Job activeJob, SessionManager sessionMgr)





Possible Reason: Upon more investigation, the error seems to have started from the moment when a record in the Upload sessions form with the status "Upload failed" is ReRun. The problem seems to be related to the ReRun function (Retail > Inquiries > Commerce Data Exchange > Upload sessions > Button ReRun)


Solution: I was able to solve this issue after unchecking 'ReRun' field in the Upload sessions table in Async Server message database. You can use the below update statement directly in SQL.


Update [Asyncserver_MSGDB_PROD].[dbo].[UPLOADSESSION] set RERUN = 0 where RERUN = 1


Hope this helps.


Also below is some more information from LCS which could possible solve other CDB related issues - Solution ID is 3211092.





Transactions are not pulling to store HQ

MITIGATION: How does Async Client know what records to upload during a P job?
In the channel database the following table is checked for each table:

SELECT ISNULL(MAX(FilterMax), 0) FROM crt.TABLEREPLICATIONLOG WHERE TABLENAME='ax.RETAILTRANSACTIONSALESTRANS' AND FILTERFIELDNAME = 'REPLICATIONCOUNTERFROMORIGIN'

This check is done with all the tables that is sent to the HQ.

So one thing you could do is to force the Channel Database into thinking that the records haven’t been uploaded to Async Server. If that table was cleared out it would “reset” the channel database and it would re-upload all records into a new RPF file.  This should be OK since any duplicate transactions would be ignored by AX.

Follow this steps:
1. Stop the AsyncClient in the StoreDB machine
2. Make a backup of the Channel Database
3. Delete records from table crt.TABLEREPLICATIONLOG
4. Start the Async Client
5. Run the P-job


No comments: