xtk.session.Write for memo element | Community
Skip to main content
Darren_Bowers
Level 9
March 19, 2020
Solved

xtk.session.Write for memo element

  • March 19, 2020
  • 1 reply
  • 5081 views

I have a temporary schema that has a bunch of normal attributes and a memo element. When I use xtk.session.Write with an XML object, the attributes update fine, but the memo element (IrMessage) is blank. Any idea how to template in an XML element in the JS?

 

 

 

<!-- Key Fields --> <attribute label="Workflow Id" length="32" name="workflowId" notNull="true" required="true" type="string"/> <attribute label="Service Order Id" length="12" name="serviceOrderId" notNull="true" required="true" type="string"/> <attribute label="Switch Document Id" length="20" name="switchDocumentId" notNull="true" required="true" type="string"/> <!-- data fields --> <attribute label="EDM Link" length="256" name="edmLink" type="string"/> <attribute label="bit.ly code" length="12" name="bitly" type="string"/> <element label="IR Message" name="IrMessage" type="memo"/> <attribute label="IR Description" name="IrDescription" type="string"/>writeRecord: function ( data ) { try{ xtk.session.Write( <TempData xtkschema="ori:TempData" _operation="insert" _key="@switchDocumentId,@serviceOrderId,@workflowId" switchDocumentId={data.switchDocumentId} serviceOrderId={data.serviceOrderId} workflowId={vars.thisWorkflowId} edmLink={data.edmLink} bitly={data.bitly} IrDescription = {data.IrDescription}> <IrMessage>{data.IrMessage}</IrMessage> </TempData>); } catch (e) { logError("Something bad happened in writeRecord: " + e); } }

 

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Darren_Bowers

Managed to do it via sqlExec, but interested to know why the above xtk.session.Write method wouldn't work

try { sqlExec("insert into oritempdata (sbitly,sedmLink,sIrDescription,mIrMessage,sswitchDocumentId,sserviceOrderId,sworkflowId) values ('" + data.bitly + "','" + data.edmLink + "','" + data.IrDescription + "','" + data.IrMessage + "','" + data.switchDocumentId + "','" + data.serviceOrderId + "','" + vars.thisWorkflowId + "');"); } catch (e) { logError("Something bad happened in writeRecord: " + e); }

1 reply

Darren_Bowers
Darren_BowersAuthorAccepted solution
Level 9
March 19, 2020

Managed to do it via sqlExec, but interested to know why the above xtk.session.Write method wouldn't work

try { sqlExec("insert into oritempdata (sbitly,sedmLink,sIrDescription,mIrMessage,sswitchDocumentId,sserviceOrderId,sworkflowId) values ('" + data.bitly + "','" + data.edmLink + "','" + data.IrDescription + "','" + data.IrMessage + "','" + data.switchDocumentId + "','" + data.serviceOrderId + "','" + vars.thisWorkflowId + "');"); } catch (e) { logError("Something bad happened in writeRecord: " + e); }
Level 6
April 29, 2024

Hi @darren_bowers,
Came across the same recently and in case we just want to avoid the sqlExec from rights and security pov, the following approach works.

Just tried pass this as an child element instead as an attribute. Got some inspiration by looking at the "Edit XML" of the data in console.

 

writeRecord: function ( data ) { try{ xtk.session.Write( <TempData xtkschema="ori:TempData" _operation="insert" _key="@switchDocumentId,@serviceOrderId,@workflowId" switchDocumentId={data.switchDocumentId} serviceOrderId={data.serviceOrderId} workflowId={vars.thisWorkflowId} edmLink={data.edmLink} bitly={data.bitly} IrDescription = {data.IrDescription}> <IrMessage><![CDATA[your text here]]</IrMessage> </TempData>); } catch (e) { logError("Something bad happened in writeRecord: " + e); } }

 

Thanks,

Deb