How to assign Datafields values in a workflow when starting process from WCF service call
kbt135357
PRODUCTObjective
The aim of this article is to give an example xml about how to start a workflow from a web service call.Before You Begin
You must be familiar with the following:
1). XML
2). SOAPUi
How-to Steps
In this example we start an instance of a workflow using WCF call, and using SoapUi. The workflow has some dependant datafield(s) values and thus needs data assigned to these datafield(s) when the workflow instance is started.
The sample workflow assigns a task to a user specified on a datafield "UserToAssignTask".
The XML needs to be in the following structure:
<soapenv:Header/>
<soapenv:Body>
<d1:StartNewProcessInstance>
<d1:processInstance Folio="TestTextFolio" FullName="K2WorkflowProject3TestTransfer" >
<d1:synchronous>false</d1:synchronous>
<d1:DataField Name="UserToAssignTask">K2:DenallixBob</d1:DataField>
</d1:processInstance>
</d1:StartNewProcessInstance>
</soapenv:Body>
</soapenv:Envelope>
In the example above, notice that the ProcessInstance xml is only closed after datafield(s) have been assigned values, not before. If it is closed before, the workflow will start but with no DataFields values, and as a result a workflow go into an "Error" state.
Below is an example of the malformed xml.
<soapenv:Header/>
<soapenv:Body>
<d1:StartNewProcessInstance>
<d1:processInstance Folio="TestTextFolio" FullName="K2WorkflowProject3TestTransfer" />
<d1:synchronous>false</d1:synchronous>
<d1:DataField Name="UserToAssignTask">K2:DenallixBob</d1:DataField>
</d1:StartNewProcessInstance>
</soapenv:Body>
</soapenv:Envelope>