Expand my Community achievements bar.

SOLVED

Facing issue while using xtk.session.Write

Avatar

Level 1

Hi All, I am currently working in Adobe V8. I have created a schema using autopk and also gave there a pk sequence. But when I am trying to insert data into that schema using xtk.session.Write unable to find key values of elements .  I am attaching code and error syntax .

 

AnushkaMukherjee_0-1693543280545.png

AnushkaMukherjee_1-1693543359492.png

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @AnushkaMukherjee 

 

It looks like you are on FFDA mode of v8.

 

Use xtk:session.Ingest method to insert data.

 

Reference link: New Campaign v8 APIs | Adobe Campaign


     Manoj
     Find me on LinkedIn

View solution in original post

12 Replies

Avatar

Community Advisor

Hello @AnushkaMukherjee 

 

Remove the _key="@id" from the code and try again.

 

_key attribute is required for update operations.


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Change 

firstName={Anushka}

 

to

 

firstName= "Anushka"

 

{} is for variable and "" is used for strings


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Could you please share the schema structure of the eps: customer?


     Manoj
     Find me on LinkedIn

Avatar

Correct answer by
Community Advisor

Hello @AnushkaMukherjee 

 

It looks like you are on FFDA mode of v8.

 

Use xtk:session.Ingest method to insert data.

 

Reference link: New Campaign v8 APIs | Adobe Campaign


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Hi @AnushkaMukherjee ,

 

Please try giving this way

 

xtk.session.Write(<customer _operation="insert" leadId="102" xtkschema='eps:customer' /> );

 

Please try with both leadId=102 once and leadId="102" with the above syntax and let me know.

 

Also try giving xtkschema Syntax at the end.

 

Regards,

Pravallika.

Avatar

Community Advisor

Hi @AnushkaMukherjee ,

 

Please try by inserting a record using the Data Loading activity into this Schema and check whether the autopk is working fine.

 

If yes, and it is only the issue with xtk.session.Write, then please try running the below SQL Code

 

alter table <SQLTableNameinPreviewTab > alter  <PrimaryKey'sInternalName> set default nextval('<pkSequenceValueinPreviewTab>'  );

 

and let me know of this works.

 

Regards,

Pravallika.

Avatar

Community Advisor

Hi @AnushkaMukherjee ,

Try below Script,

vars.leadId = 1234;
xtk.session.Write(<customer _operation="insert" leadId={vars.leadId}  xtkschema='eps:customer'/>  );

With the above Script am able to insert a record in schema with leadId as 1234.

ParthaSarathy_0-1693558743242.png

 

And in your console version, if you still face error for xtk.session.Write, alternatively you can try below script,

vars.leadId = 1234;
sqlExec("insert into EpsCustomer (iLeadId) values ('"+ vars.leadId + "');");

 

Avatar

Administrator

Hi @AnushkaMukherjee,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!



Sukrity Wadhwa