Expand my Community achievements bar.

The first preview of our new Community upgrade is live - check it out now.

Duplicate key error on custom table with autopk="true"

Avatar

Level 4

Hi,

We are experiencing a recurring duplicate key error when inserting records into a custom Adobe Campaign Classic schema via a SOAP web service. The error is:
Cannot insert duplicate key row in object 'neolane.LfTmResponseAPIData'
with unique index 'LfTmResponseAPIData_id'

In the schema we have just this:
 <element autopk="true" desc="this schema contains the data as received for TM response data into lf:tmResponseService.jssp"
label="tmResponseAPIData" name="tmResponseAPIData">

What is the correct and supported way in Adobe Campaign Classic to ensure unique IDs and avoid duplicate key errors in this situation?

Do I need to define a an unique key in the schema as below?
<key name="tmResponseIdx">
<keyfield xpath="@field1"/>
<keyfield xpath="@field2"/>
</key>

Or do I need to create a new sequence in xtkNewId? How do I proceed in this case?

Thanks


2 Replies

Avatar

Level 10

The error may be in the your custom API handler rather than the schema, seems you are consuming via the jssp custom api rather than the soaprouter native api?

 

Share a sample request, and the jssp endpoint script.

Avatar

Community Advisor

Hi @A_B_SE 

 

a) Please try to avoid sending the @id value in the SOAP Call and let the Adobe Campaign generate the auto generated sequence using autopk="true"

b) Also, to avoid duplicates, please try adding the unique DB Index ,with example syntax below:

<dbindex name="tmResponseIdx" unique="true">
  <keyfield xpath="@field1"/>
  <keyfield xpath="@field2"/>
</dbindex>
c) Please check if the custom schema is not using the OOTB sequence "XtkNewId".
 
Regards,
Pravallika.