How to assign Datafields values in workflow when starting process from WCF service via SoapUi

  • 24 February 2022
  • 0 replies
  • 1 view

Userlevel 4
Badge +16




 








How to assign Datafields values in a workflow when starting process from WCF service call

































This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.






LEGACY/ARCHIVED CONTENT


This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.




Objective



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:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:d1="http://schemas.k2.com/process/d1" xmlns:d11="http://schemas.k2.com/worklist/d1">
              <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:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:d1="http://schemas.k2.com/process/d1" xmlns:d11="http://schemas.k2.com/worklist/d1">
              <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>









0 replies

Be the first to reply!

Reply