Skip to main content
Nintex Community Menu Bar
$k2Credentials = Get-Credential -Message ("Please enter K2 credentials")$k2Proxy = New-WebServiceProxy -Uri "http://yourServer.com/K2Services/WS.asmx?wsdl" -Credential $k2Credentials$k2Proxy.PreAuthenticate = $true$k2namespace = $k2Proxy.GetType().Namespace$pi = new-object ($k2namespace + ".ProcessInstance")$pi.FullName = "folderprocess"$pi.Folio = "Some folio"$pi.DataField += new-object ($k2namespace + ".DataField")$pi.DataField[0].Name = "Name1"$pi.DataField[0].Value = "Value1"$pi.DataField += new-object ($k2namespace + ".DataField")$pi.DataField[1].Name = "Name2"$pi.DataField[1].Value = "Value2"$k2Proxy.StartNewProcessInstance([ref]$pi, $false)

PowerShell:


[System.Console]::WriteLine("Sample code to start a K2 process")


Add-Type -AssemblyName ('SourceCode.Workflow.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d')


$conn = New-Object -TypeName SourceCode.Workflow.Client.Connection


$conn.Open("localhost")


$pi = $conn.CreateProcessInstance("FolderProcessName")


$conn.StartProcessInstance($pi)


$conn.Close


 


https://help.k2.com/onlinehelp/k2blackpearl/devref/4.6.4/webframe.html#using_the_windows_powershell_to_start_a_k2_process.html


 


Web Services:


/K2Services/REST.svc/Process/Definitions(K2%20Examples_B_Order%20Process)/StartInstance?folio=New-Order


Replacements


 


https://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.7/default.htm#WorkflowWebServiceASMX.htm


https://help.k2.com/onlinehelp/k2blackpearl/DevRef/4.7/default.htm#WorkflowRESTServices.htm


 


Yes, but that requires K2 to be installed. The first approach doesn't need that and can be executed on any remote system!


From Web service option, how can I include setting datafield values while starting a workflow?


Reply