Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Previous version of the workflow is getting attached

$
0
0

SP Version: SharePoint 2013 on premise.

I have deployed a SharePoint designer reusable workflow (SP 2010  approval workflow) as a Sandbox solution using Visual studio . The workflow is started using an item checkin event receiver.

In many cases, when a new item is checked in to the library the previous version of this workflow is attached instead of the latest version.

I tried resetting the owstimer.exe, but the issue is still present.

When I make changes to the workflow using designer, I save it as a wsp, extract the files, then replace the xml and xoml files in my Visual studio project.

Please suggest a solution to this.

I tried removing the previous version of the workflow using the powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell

#Set the $ErrorActionPreference to "STOP" so that the script stops if there are any errors

$ErrorActionPreference = "STOP"

#Declare the Variables
$web = Get-SPWeb

$listToCancel = "CodePlex Links"

$list = $web.Lists[$listToCancel]

$tempList = New-Object "System.Collections.Generic.List``1[System.Object]"

#Workflow Name.  check against the Workflow Status Column
$wfToKeep = "xxxxWorkflow"

foreach ($wf in $list.WorkFlowAssociations) {
 
if ($wf.Name -ne $wfToKeep) { $tempList.Add($wf); }

 }

foreach ($wf in $tempList){ $list.RemoveWorkflowAssociation($wf); }

this script does not seem to work as well in removing previous versions.

No new instance is checked for the previous versions.

How do I ensure that when a new item is checked-in to the library it picks up the latest version of the workflow.





Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>