Thursday 25 October 2018

Violation of PRIMARY KEY constrain. Cannot insert duplicate key in object ‘ax.RETAILTRANSACTIONTABLE’

Getting Error at the time of billing at POS "Violation of PRIMARY KEY constraint 'I_-1558077251_-1679712867'.Cannot insert duplicate key in object 'ax.RETAILTRANSACTIONTABEL'.The duplicate key value is (XX,XXX,XXXXXX,XXXX,cri). The statement has been terminated."


To void such error, try to setup the CDX components so that the transaction at POS sync to AX. Use the above form to calculate POS number sequence and push this data using 1160 job back to POS. Once the data is updated to POS, it will start creating transaction based on next number.

Retail > Periodic > Retail POS Redeployment 


This store procedure also returns the current numbers to be used for the fields TransactionID, ReceiptID
 in the table “ax.RETAILTRANSACTIONTABLE”. The P-job sends the data periodically from this table to back office (AX) in the equivalent table “RetailTransactionTable”

 In order to view the current seed data, Go to Retail>Periodic>Retail POS Redeployment form.



In order to calculate the POS number sequence details for a register, create a new record and select the store and register.  Click the button “Calculate POS number sequence”. This will call a static method in the RetailPOSSeedData to calculate the current used numbers for different data type.
You may edit this numbers using “Edit POS number seq..” and set new numbers and push the data back to POS. Use the scheduler job 1160 (POS redeployment) to perform this.  Based on this, a new number sequence will be generated in the POS. But, if the “ax.RETAILTRANSACTIONTABLE” has already a records with same number POS transaction will not take palce successfully due to duplicate key error as follows:

Violatio  of PRIMARY KEY constrain. Cannot insert duplicate key in object ‘ax.RETAILTRANSACTIONTABLE’.

No comments:

Post a Comment