Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

xtk.session.IngestExt Error in update record

Avatar

Level 2
 
I'm having trouble using "xtk.session.IngestExt." It gives the following error: "It is not possible to manually update or inseran auto primary key in schema 'sam:ape_controlStg'." But I don't want to replace the primary key; I'd just like to update some fields in this record.

My schema:
<srcSchema _cs="APE Control Novo (Staging) (sam)" created="2025-08-21 19:13:37.861Z"
createdBy-id="1798076558" entitySchema="xtk:srcSchema" img="xtk:schema.png"
implements="" label="APE Control Novo (Staging)" labelSingular=" (Staging)"
lastModified="2025-08-21 20:19:24.121Z" mappingType="sql" md5="EF5A2F7F49FDADA85180E1F813AED08D"
modifiedBy-id="1798076558" name="ape_controlStg" namespace="sam" stgSrcSchema="sam:ape_control"
useRecycleBin="false" xtkschema="xtk:srcSchema">
<enumeration basetype="string" default="" name="enumControlStatus">
<value label="NOT_PROCESS" name="NOT_PROCESS" value="NOT_PROCESS"/>
<value label="PROCESSING" name="PROCESSING" value="PROCESSING"/>
<value label="ERROR" name="ERROR" value="ERROR"/>
<value label="OK" name="OK" value="OK"/>
</enumeration>
<element autoStg="false" autopk="true" autouuid="true" hybrid="false" label=" (Staging)"
name="ape_controlStg" sqltable="SamApe_controlStg">
<compute-string expr="@id"/>
<key internal="true" name="id">
<keyfield xpath="@id"/>
</key>
<attribute desc="Internal primary key" label="Primary key" name="id" sqlname="uApe_controlId"
type="uuid"/>
<attribute enum="enumControlStatus" label="Status" length="255" name="process_status"
sqlname="sProcess_status" type="string"/>
<element advanced="true" hybrid="false" integrity="neutral" label="Replication Strategy"
name="replicationStrategy" revLink="ape_controlStg" target="nms:replicationStrategy"
type="link"/>
<attribute default="false" name="delete" type="boolean"/>
<attribute default="GetDate()" label="Modification date" name="lastModified"
type="datetime"/>
<index name="lastModifiedStg">
<keyfield xpath="@lastModified"/>
</index>
</element>
</srcSchema>

My code:
var xmlStagingSampleTable = <ape_controlStg _key="@id"
id="MyID"
process_status="NOT_PROCESS"
xtkschema="sam:ape_controlStg">
</ape_controlStg>;
strUuid = xtk.session.IngestExt(xmlStagingSampleTable)

1 Reply

Avatar

Level 2

Hi @Wilnaweb1,

You're running into this error because the @ID field in your schema (sam:ape_controlStg) is set to auto-generate as a UUID:

<attribute name="id" type="uuid" autopk="true" autouuid="true" ... />


This means Adobe Campaign Classic automatically handles the primary key (@id) when new records are inserted, and it doesn't allow you to manually assign a value — even if you're trying to update an existing record.

What's causing the issue:

In your IngestExt() call, you're doing something like this:

var xmlStagingSampleTable = <ape_controlStg _key="@id"
id="MyID" // manually setting an auto-generated ID
process_status="NOT_PROCESS"
xtkschema="sam:ape_controlStg" />;

strUuid = xtk.session.IngestExt(xmlStagingSampleTable);


Because you're passing a manual @ID, Campaign treats it as a new insert rather than an update, which causes the error.

How to fix it:

If you're trying to update an existing record, it's better to use xtk.session.Write() instead:

var xml = <ape_controlStg xtkschema="sam:ape_controlStg"
id="EXISTING_UUID"
process_status="OK" />;

xtk.session.Write(xml);


This tells Campaign to update the record with the provided @ID.

Hope this helps!

Thanks,