Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrieve parameter from a SOAP request in a workflow

salvdangelo
Level 5
Level 5

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

1 Accepted Solution
salvdangelo
Correct answer by
Level 5
Level 5

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

View solution in original post

7 Replies
David__Garcia
Level 8
Level 8

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

salvdangelo
Correct answer by
Level 5
Level 5

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

View solution in original post

dattarays703613
Level 1
Level 1

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

David__Garcia
Level 8
Level 8

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

dattarays703613
Level 1
Level 1

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?

David__Garcia
Level 8
Level 8

Hey datta,

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