Issue passing associated data with StartWorkflow web service call

  • 28 July 2014
  • 2 replies
  • 23 views

Userlevel 3
Badge +9

I have a list and a document library. On the list I have a workflow running where at a certain point I use a call web service action to call the StartWorkflow web service to start a workflow called "Approve Document" on the document library.  As part of this I want to pass a variable into the workflow to use for the approval comments. However I have not been able to successfully pass the variable.  The workflow starts and runs, but the variable is empty.  I've read the threads I could find on the old site, and tried every variation I could think of, but to no avail. 

Here is the SOAP for the StartWorkflow web service call.  I have a variable in the Approve Document workflow named "st_DocumentComments", and I have it marked to show on the start form.  I've tried using <associationData>  and even the default of <m:associationData>.  I've tried it with the "Encode inserted tokens" checked and unchecked.  I've tried every option I could think of, yet nothing works.  And I'm not getting any errors.  I'm hoping there is something simple I'm just overlooking that another pair of eyes could help with.  Anyone have any ideas?

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://nintex.com">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:StartWorkflow>

      <m:fileUrl>{WorkflowVariable:st_DocumentUrl}</m:fileUrl>

      <m:workflowName>Approve Document</m:workflowName>

      <Data>

      <st_DocumentComments>{WorkflowVariable:st_Comments}</st_DocumentComments>

      </Data>

    </m:StartWorkflow>

  </soap:Body>

</soap:Envelope>


2 replies

Userlevel 3
Badge +9

Found the answer.  Found this gem on the old site How to: Start a workflow via the ‘Call web service’ action‌.  I had to use a Build a String action to construct the associatedData variable.  I formatted it as follows:

<Data>

<DocumentStatus>Approved</DocumentStatus>

<st_DocumentComments>Looks Good</st_DocumentComments>

</Data>

I saved that variable as "aData".  I then used that variable into the associationData field.  So the final SOAP looks like this. 

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://nintex.com">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:StartWorkflow>

      <m:fileUrl>{WorkflowVariable:st_DocumentURL}</m:fileUrl>

      <m:workflowName>Update Document Status</m:workflowName>

      <m:associationData>{WorkflowVariable:aData}</m:associationData>

    </m:StartWorkflow>

  </soap:Body>

</soap:Envelope>

Ran it and worked perfect.

Badge +3

Hi,

When i use Association Data built by a "Build a String" task I get an error:

"The remote server returned an error: (400) Bad Request."

String Built: <Data> <ID>{WorkflowVariable:ID}</ID> </Data>  ------(AssociationData)

XML:

  <m:StartWorkflowOnListItem>

    <m:itemId>{WorkflowVariable:ID}</m:itemId>

    <m:listName>MonitorSiteUsage</m:listName>

    <m:workflowName>Monitor Site Send Notification</m:workflowName>

    <m:associationData>{WorkflowVariable:AssociationData}</m:associationData>

  </m:StartWorkflowOnListItem>

But if I structure my XML like :

  <m:StartWorkflowOnListItem>

    <m:itemId>11</m:itemId>

    <m:listName>MonitorSiteUsage</m:listName>

    <m:workflowName>Monitor Site Send Notification</m:workflowName>

    <Data>

    <m:associationData>

    <ID>11</ID>

    </m:associationData>

    </Data>

  </m:StartWorkflowOnListItem>

I do not get any error and the Response obtained is :

  <StartWorkflowOnListItemResponse xmlns="http://nintex.com">

      <StartWorkflowOnListItemResult>3b6a3392-8093-4a76-8438-b35b5a082f4d</StartWorkflowOnListItemResult>

    </StartWorkflowOnListItemResponse>

But still the workflow variable passed in the target workflow returns out to be blank or null.

Can you please help?

Regards,

Shyam

Reply