Expand my Community achievements bar.

SOLVED

Adobe Campaign Classic : MEMO field not getting inserted into AC DB when tried with SOAP API queries in workflow javascript.

Avatar

Level 1

I have a survey schema that has a bunch of normal attributes and a memo element. When I use xtk.session.Write with an XML object, the string & date attributes update fine in DB, but the memo elements are not getting updated and is blank.
The form field values are stored in local variable and are substituted in the query in javascript. Any idea how to template in an XML element for variable values for memo element in the JS. If i hard code normal text in between xml element of memo fields it is getting stored but not the vars.
Schema elements & attributes :
<attribute desc="Unique Customer ID" label="Customer ID"
length="40" name="cusId" type="string"/>
<attribute desc="Question1" label="Question1" length="40" name="question1"
type="string"/>
<attribute desc="Question2" label="Question2" length="40" name="question2"
type="string"/>
<attribute desc="Question3" label="Question3" length="40" name="question3"
type="string"/>
<attribute desc="Question4" label="Question4" length="40" name="question4"
type="string"/>
<attribute desc="Question5" label="Question5" length="40" name="question5"
type="string"/>
<attribute desc="Question6" label="Question6" length="40" name="question6"
type="string"/>
<attribute desc="Survey Created Date" label="Survey Created Date" name="createdDate"
type="datetime"/>
<element desc="Comment" label="Unsatisfied experience"
name="commentunsatisfaction" type="memo" xml="true"/>
<element desc="Comment" label="Suggestion" name="commentimprovements"
type="memo" xml="true"/>

Query:
var query = <survey _operation='insert' _key='@cusId' cusId={ctx.vars.userId} question1={ctx.vars.question1} question2={ctx.vars.question2} question3={ctx.vars.question3} question4={ctx.vars.question4} question5={ctx.vars.question5} question6={ctx.vars.question6} createdDate={currentDate} xtkschema="cus:survey"><commentunsatisfaction>{ctx.vars.comment1}</commentunsatisfaction><commentimprovements>{ctx.vars.comment2}</commentimprovements></survey>;
xtk.session.Write(query);

 

Please provide your inputs.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Use xtk.persist.Write().

 

Thanks,

-Jon

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi,

 

Use xtk.persist.Write().

 

Thanks,

-Jon

Whats the difference between the two Write methods? Why does xtk.session.Write() fail when xtk.persist.Write() work?

Thanks Jon, When i tried to use the above method i am getting the following error,

XFR-180000 The file '/usr/local/neolane/nl6/datakit/xtk/eng/schema/persist.xml' does not exist on the server. Unable to load the document of identifier 'xtk:persist' and type 'xtk:schema'.
 
I could not find any xtk:persist schema in my ACC instance unlike xtk:session. Is there some additional packages to be deployed for this. 
My console build is 9032
Application server build : 8936.
 
Thanks

Avatar

Level 9
I got the same error with xtk.persist.Write() on 9032 and I couldn't get xtk.session.Write() to work with templated variables and memo objects. I ended up hacking a database insert together with sqlExec() https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/xtk-session-write-...