Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

Slowness when making scans for items at points of sale

Posted on by 10

i'm currently having this issue and It slows down the points of sale. could you please share with me, how can this be resolved?

ApplySessionFileToClientDatabase encountered Exception. Error Details: Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessTargetRequestHeaderException: ProcessTargetRequestHeader failed to execute all write requests. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessWriteRequestException: Write request on table:[ax].[RETAILPERIODICDISCOUNTLINE] failed to execute. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.RunException: Run() failed while performing write operation on table. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.PerformWriteOperationException: Query: MERGE [ax].[RETAILPERIODICDISCOUNTLINE] AS dst
USING (SELECT [DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID] FROM [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801]) AS src
ON (dst.[RECID]=src.[RECID])
WHEN MATCHED THEN
UPDATE SET [DISCOUNTPERCENTORVALUE]=src.[DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE]=src.[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED]=src.[ISDISCOUNTCODEREQUIRED],[LINENUM]=src.[LINENUM],[NAME]=src.[NAME],[OFFERID]=src.[OFFERID],[RELATIONTYPE]=src.[RELATIONTYPE],[RETAILGROUPMEMBERLINE]=src.[RETAILGROUPMEMBERLINE],[STATUS]=src.[STATUS],[UNITOFMEASURE]=src.[UNITOFMEASURE],[DATAAREAID]=src.[DATAAREAID]
WHEN NOT MATCHED THEN
INSERT ([DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID])
VALUES (src.[DISCOUNTPERCENTORVALUE],src.[INSTANCERELATIONTYPE],src.[ISDISCOUNTCODEREQUIRED],src.[LINENUM],src.[NAME],src.[OFFERID],src.[RECID],src.[RELATIONTYPE],src.[RETAILGROUPMEMBERLINE],src.[STATUS],src.[UNITOFMEASURE],src.[DATAAREAID]);
DROP TABLE [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801];
---> System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'I_-2095525985_1217888543'. Cannot insert duplicate key in object 'ax.RETAILPERIODICDISCOUNTLINE'. The duplicate key value is (NS-000010, 0.4375000335276130, ns).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
at Microsoft.Dynamics.Retail.SynchClient.Core.DownloadAgent.ApplySessionFileToClientDatabase(SessionManager sessionMgr, String fileName)Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessTargetRequestHeaderException: ProcessTargetRequestHeader failed to execute all write requests. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessWriteRequestException: Write request on table:[ax].[RETAILPERIODICDISCOUNTLINE] failed to execute. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.RunException: Run() failed while performing write operation on table. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.PerformWriteOperationException: Query: MERGE [ax].[RETAILPERIODICDISCOUNTLINE] AS dst
USING (SELECT [DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID] FROM [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801]) AS src
ON (dst.[RECID]=src.[RECID])
WHEN MATCHED THEN
UPDATE SET [DISCOUNTPERCENTORVALUE]=src.[DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE]=src.[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED]=src.[ISDISCOUNTCODEREQUIRED],[LINENUM]=src.[LINENUM],[NAME]=src.[NAME],[OFFERID]=src.[OFFERID],[RELATIONTYPE]=src.[RELATIONTYPE],[RETAILGROUPMEMBERLINE]=src.[RETAILGROUPMEMBERLINE],[STATUS]=src.[STATUS],[UNITOFMEASURE]=src.[UNITOFMEASURE],[DATAAREAID]=src.[DATAAREAID]
WHEN NOT MATCHED THEN
INSERT ([DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID])
VALUES (src.[DISCOUNTPERCENTORVALUE],src.[INSTANCERELATIONTYPE],src.[ISDISCOUNTCODEREQUIRED],src.[LINENUM],src.[NAME],src.[OFFERID],src.[RECID],src.[RELATIONTYPE],src.[RETAILGROUPMEMBERLINE],src.[STATUS],src.[UNITOFMEASURE],src.[DATAAREAID]);
DROP TABLE [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801];
---> System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'I_-2095525985_1217888543'. Cannot insert duplicate key in object 'ax.RETAILPERIODICDISCOUNTLINE'. The duplicate key value is (NS-000010, 0.4375000335276130, ns).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
at Microsoft.Dynamics.Retail.SynchClient.Core.DownloadAgent.ApplySessionFileToClientDatabase(SessionManager sessionMgr, String fileName)

Categories:
  • Mostafa Sadek Profile Picture
    Mostafa Sadek 10 on at
    RE: Slowness when making scans for items at points of sale

    This happens sometimes during the sale, not all the time, and this error always appears event viewer

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans