Retrieve parameter from a SOAP request in a workflow

Avatar

Avatar

salvdangelo

Avatar

salvdangelo

salvdangelo

18-01-2018

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?
Workflow.JPG

Thanks in advance,

Salvatore

Jean-Serge Biron

@nkur

Adhiyan

kirti.rawat

Amy_Wong

Debbie

Adobe Campaign

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

salvdangelo

Avatar

salvdangelo

salvdangelo

18-01-2018

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

Answers (6)

Answers (6)

Avatar

Avatar

david_garcia1

MVP

Avatar

david_garcia1

MVP

david_garcia1
MVP

18-01-2018

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);

Avatar

Avatar

dattarays703613

Avatar

dattarays703613

dattarays703613

23-01-2018

Got the solution, thanks.

Avatar

Avatar

david_garcia1

MVP

Avatar

david_garcia1

MVP

david_garcia1
MVP

23-01-2018

Hey datta,

I am happy you were able to sort it out, could you please share your solution to the community.

Avatar

Avatar

dattarays703613

Avatar

dattarays703613

dattarays703613

22-01-2018

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?

Avatar

Avatar

david_garcia1

MVP

Avatar

david_garcia1

MVP

david_garcia1
MVP

22-01-2018

@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);

Avatar

Avatar

dattarays703613

Avatar

dattarays703613

dattarays703613

22-01-2018

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..)