Hi,
I am trying to start a workflow and send variables through a SOAP request like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">
<soapenv:Header/>
<soapenv:Body>
<urn:PostEvent>
<urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>
<urn:strWorkflowId>26000231</urn:strWorkflowId>
<urn:strActivity>signal</urn:strActivity>
<urn:strTransition></urn:strTransition>
<urn:elemParameters>
<variables>
<email>your@email.com</email>
</variables>
</urn:elemParameters>
<urn:bComplete></urn:bComplete>
</urn:PostEvent>
</soapenv:Body>
</soapenv:Envelope>
How can I retrieve the information inside <email></email> ?
Here an example of the workflow.
How should I pick up the email (or another variable inside <variables>) inside a JS code?
Thanks in advance,
Salvatore
Solved! Go to Solution.
Hi David Garcia,
I am aware of the option you're proposing but the request is on an external source and executed with a SOAP request.
Anyway I've just found the solution:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">
<soapenv:Header/>
<soapenv:Body>
<urn:PostEvent>
<urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>
<urn:strWorkflowId>26000231</urn:strWorkflowId>
<urn:strActivity>signal</urn:strActivity>
<urn:strTransition></urn:strTransition>
<urn:elemParameters>
<variables email="your@email.com" >
</variables>
</urn:elemParameters>
<urn:bComplete></urn:bComplete>
</urn:PostEvent>
</soapenv:Body>
</soapenv:Envelope>
The script you wrote above is correct: vars.email
Thanks anyway!
Salvatore
Top of my head, try
logInfo(vars.email)
Here is an scenario
You can post variables from a webapp to a workflow
xtk.workflow.PostEvent("wkfInternalName", "mysignal", "", <variables id={latestEntry.Records.@id} status={ctx.vars.status} type={ctx.vars.type} serviceType={ctx.vars.serviceType} participation={ctx.vars.participation} category={ctx.vars.category} distribution={ctx.vars.distribution} proof={ctx.vars.proof} />, false);
Then in the workflow javascript you can log what was posted from the webapp
logInfo(vars.status);
Hi David Garcia,
I am aware of the option you're proposing but the request is on an external source and executed with a SOAP request.
Anyway I've just found the solution:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">
<soapenv:Header/>
<soapenv:Body>
<urn:PostEvent>
<urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>
<urn:strWorkflowId>26000231</urn:strWorkflowId>
<urn:strActivity>signal</urn:strActivity>
<urn:strTransition></urn:strTransition>
<urn:elemParameters>
<variables email="your@email.com" >
</variables>
</urn:elemParameters>
<urn:bComplete></urn:bComplete>
</urn:PostEvent>
</soapenv:Body>
</soapenv:Envelope>
The script you wrote above is correct: vars.email
Thanks anyway!
Salvatore
Hi,
Is there a way to read "child" tags under the <variables> tag, within JS of a workflow?
e.g.
<variables>
<product>
<name>XYZ</name>
<quantity>2</quantity>
</product>
</variables>
using vars.XXX, will read properties of <variables> tag only but in case of more complex values to read, can above be possible?
(vars.product.name: doesn't work..)
Views
Replies
Total Likes
@dattarays70361342 Start playing with the following, should give you an idea.
var payload = <rtEvent>
<ctx>
<recipient>
<firstName>David</firstName>
<lastName>Garcia</lastName>
</recipient>
</ctx>
</rtEvent>
vars.fullName = payload.ctx.recipient.firstName+" "+payload.ctx.recipient.lastName;
logInfo(vars.fullName);
Views
Replies
Total Likes
Thanks David
- rtEvent API is quite flexible/standard, it accepts XML structure and XML is as-is accesible within message templates, no issue with rtEvent API
- The issue is with "PostEvent" API of the xtk:workflow which accepts i/p parameters only within <variables /> tag.
The <variables /> tag properties I can read with vars.xxx way but if the parameters are going to hold multiple values, how do we handle them? (using "comma" separated values is not reliable and doesn't provide much flexibility) hence I am trying to check if what I am trying to send in "PostEvent" <variables> ... </variables> tag as child tags, can they be accessed within workflow JS code?
PushEvent XML extract:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">
<soapenv:Header/>
<soapenv:Body>
<urn:PostEvent>
<urn:sessiontoken>XXXX</urn:sessiontoken>
<urn:strWorkflowId>WKF1028</urn:strWorkflowId>
<urn:strActivity>signal</urn:strActivity>
<urn:strTransition></urn:strTransition>
<urn:elemParameters>
<variables>
<product>
<name>XYZ</name>
<quantity>2</quantity>
</product>
<product>
<name>PQR</name>
<quantity>1</quantity>
</product>
</variables>
</urn:elemParameters>
<urn:bComplete>0</urn:bComplete>
</urn:PostEvent>
</soapenv:Body>
</soapenv:Envelope>
how to read product details from the above postevent within workflow JS, using vars.xxx?
Views
Replies
Total Likes
Got the solution, thanks.
Hello,
We have an almost similar use case, can you let us know the solution that worked for you. Thanks in advance.
Views
Replies
Total Likes
Hey datta,
I am happy you were able to sort it out, could you please share your solution to the community.
Views
Replies
Total Likes