I extract the xml using
var wf = NLWS.xtkWorkflow.get(id);
var str = wf.toDocument().toXMLString()
and try to write it back again using
result = sqlExec("update xtkWorkflow set mData = '" + tempChunk + "' || mData where sInternalName = '" + internalName + "'");
Problem is, I guess, if the string "tempChunk" contains the combination "$(" as in "$(vars/@tableName)" the sqlExec-function believes I'm trying to use one of these function specific substition parameters:
$(dur) timespan en millisecondes (ms)
and fails with an error message like this one:
2018-05-30 14:14:54 js2 Type 'vars/@tableName' is not a valid type of parameter.
Or its more of generic that you need to find something withing any place of wkf and remove it?
PS: I think what you did will work but instead of sqlExec do xtk.session.write(your changed workflow xml where you have added _key = wkf id and _operation = update) See the documentation how shold the xml look [Data oriented APIs]
This way of changing properties of an entity (recipient, workflow etc.) seems straight forward and easy to use, but does it apply even if I'm aiming to change a certain detail in the xml-code of the wf (in the XML Memo) and then want to save it? What I want to do specifically is remove the <line>-tags in all of the <samleLines>-tags (if the wf contains any)...
...and then save the XML-code of the workflow (to get rid of example data). I've already encounter a few difficulties doing this, having had to split the XML-code-string into smaller substrings and append them to the database field in a loop to be able to save them using sqlExec() for example. But I think I've got it working now except for this last "$("-obstacle...
Can I save the XML Memo (even a very large one) using the methods you suggested? E.g.
var wkf = xtk.workflow.get(id);
wkf.label = "new label";
wkf.data = variableContainingXMLmemo;
By using xtk.session.write where your workflow id will be _key and _operation set as update (and adding something like "data = variableContainingXMLmemo")?