Skip to main content

Hello,

I have taken over a workflow that has been poorly designed using a 1 year pause action before the item is deleted...

Because the workflow runs as the initiator but permissions are changed during workflow exectuion removing contribute access to the initiator, after the 1 year pause the workflow gets into error (no right to delete item).

I have fixed the workflow for new submissions and used powershell to change permissions on items with running workflows that are in pause state so items can be deleted when they reach the date, but the older workflows are in error (a couple of hundred).

My question: is there an relatively easy way to do a mass update on this list to end the running workflows in error and delete the related items ? I don't see myself manually ending all these workflows one by one.

 

Thank you

 

 

 

Hi @Sylvain,



 



You could create a workflow (probably best as a Site Workflow) to identify the ItemIDs and then loop through the ItemIDs to terminate workflows for each relevant item using the NintexWorkflow web service located at http://<site>/_vti_bin/NintexWorkflow/Workflow.asmx. Since the items in question are being deleted anyway, maybe the TerminateWorkflowByNameForListItem operation would be best.



 



After all workflow instances for each of these items is terminated, you can also delete these items via a workflow in a similar manner; looping through the relevant ItemIDs and using the 'Delete Item' action.



 



Here is some relevant documentation for your reference:



 



Web Service Reference



https://help.nintex.com/en-US/sdks/sdk2013/Reference/SOAP/NW_REF_SOAP_NAV.htm



 



Terminating workflows



https://help.nintex.com/en-US/sdks/sdk2013/#Operational/SDK_NW_OPS_WorkflowsTerminating.htm



 



TerminateWorkflowByNameForListItem



https://help.nintex.com/en-US/sdks/sdk2013/Reference/SOAP/NW_REF_SOAP_TerminateWorkflowByNameForListItem.htm



 



Hope this helps!


Thanks for the post nicksha. The other problem I have is I don't want the initiator to be notified that the workflow was terminated which I believe is currently the behaviour. Can this be avoided ?



Instead of using the web service do you think I could achieve the same result with powershell ?


I have this issue right now and I wonder how did you do it, all looking for Powershell solution and the initiator will not be informed also.


Did you find the solution please, can you tell me how you did it .

Reply