Skip to main content
Nintex Community Menu Bar

Double Task on PowerShell start

  • August 7, 2017
  • 1 reply
  • 7 views

Forum|alt.badge.img+1

When I start the Workflow with a PowerShell script, then I got 2 tasks with the same name to complete.

The first one says no task ID found , the second one works. But the desired behaviour is only one task should appear.

When the workflow is started manually then there is only one task. The task is a simple confirmation.

Here is the  PowerShell code to call the Workflow:

$web = Get-SPWeb $mySiteUrl
$list = $web.Lists[$sDocLibraryName]
$wfm = $web.Site.WorkFlowManager
$association = $list.WorkFlowAssociations |Where { $_.Name -eq $WFName}
$data = $association.AssociationData

$wc=new-object system.net.webclient
$wc.Credentials = Import-Clixml $credentialsPath

$item = $list.GetItemById($listItemID);

$wf = $wfm.Startworkflow($item,$association, $data,$true)

Write-Host "Workflow started, please wait 10 seconds" -ForegroundColor Green;

Start-Sleep -Seconds 10

$web.Dispose();

1 reply

Forum|alt.badge.img+1
  • Author
  • August 8, 2017

Did a test on a simple workflow with just a task and the PowerShell script started it with just one.

As the main workflow was pretty huge I've put a 5 min. wait action before the task and the problem was solved.