cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calling Nintex workflow manually or using powershell along with Association Data

Due to certaing necessity I have to end and restart some of the workflows manually. The problem I am facing is that in ideal case these workflows are triggered by another Workflow that passes some data (using 'Association Data' in web service). But when I start it Manually how do I pass this association data and make sure the WF's run smoothly as this data is used in the called WF. If its possible via PowerShell that also will be helpful.

Thanks in Advance.

0 Kudos
Reply
2 Replies
Highlighted
Not applicable

Re: Calling Nintex workflow manually or using powershell along with Association Data

You can use PowerShell script to call Nintex Workflow webservice to start your workflow. Here is some PowerShell script snippet that calling Nintex WebService to start site workflow and pass in association data:

$siteUrl = "<site url>"

$url = $siteUrl + "/_vti_bin/nintexworkflow/workflow.asmx"

$workflowName = "Check Term Exists"

$associationData = "<Data><Term to search>Workflow (On Premise)</Term to search></Data>"

#Replace Term to search to your workflow variable name, and corresponding value

$ws = New-WebServiceProxy -Uri $url -UseDefaultCredential

$ws.StartSiteWorkflow($workflowName, $associationData);

More how to use, you can refer to this:

Start a Workflow using a Web Service

0 Kudos
Reply
motorboy
Nintex Newbie

Re: Calling Nintex workflow manually or using powershell along with Association Data

There is an example for "StartWorkflowOnListItem"

# Loads SharePoint PowerShell SnapIn

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy  unrestricted -Force # answer Y

$spCmdlets = Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction silentlycontinue

if ($spCmdlets -eq $Null) { Add-PSSnapin Microsoft.SharePoint.PowerShell }

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

[System.Net.ServicePointManager]:Smiley FrustratederverCertificateValidationCallback = {$true}

# Get Site Collection and Web info

$siteCollectionURL = "https://portal.company.com"

$spSite = Get-SPSite $siteCollectionURL

$spWeb = Get-SPWeb $siteCollectionURL

$spWebURL = $spWeb.Url

$spListURL = $($spWeb.Url + "/Lists/ListName")

$spList = $spWeb.GetList($spListURL)

$listItemId = "49"

# Nintex Workflow Web Service

$workflowName = "NotifyMe"

### If you need to send XML, it is necessary to XML Encode the body###

$transferData = "&lt;inputData&gt;&lt;xmlNode1&gt;Text containing XML node 1&lt;/xmlNode1&gt;&lt;xmlNode2&gt;Text containing XML node 2&lt;/xmlNode2&gt;&lt;xmlNode3&gt;Text containing XML node 3;&lt;/xmlNode3&gt;&lt;/inputData&gt;"

[String]$associationData = "<Data><inputXML>" + $transferData + "</inputXML></Data>"

$username = "Company\user"

$password = "password"

$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force

$credential = New-Object System.Management.Automation.PSCredential($username,$secpasswd);

$proxyWSUrl = $spWebURL + "/_vti_bin/NintexWorkflow/workflow.asmx"

$proxyWSUrl = $proxyWSUrl

$proxy = New-WebServiceProxy -Uri $proxyWSUrl -Credential $credential

$proxy.Url = $proxyWSUrl

$workflow = $proxy.StartWorkflowOnListItem($listItemId,$spList,$workflowName,$associationData)

0 Kudos
Reply