2

I continue to work on trying to get the internal status of all workflows on my site to find any that have been suspended. The internal suspended status does not change the status column, so I can't just query on that column.

I've found some examples oh how to check each item id in a list using SP.WorkFlowInstanceService.enumerateInstancesForListItem('listguid','itemid'). But that is like searching for a needle in a haystack. I have dozens of lists with thousands of items and no way of knowing which ones might even have a status of suspended.

A step better, kinda, is that I've found SP.WorkflowInstanceService.enumerate(workflowSubscription) (It isn't the guid, but a complex type, oh why?) This returns the 100 most recent workflow instances started for the specified subscription. Documentation here—I know that isn't the JSOM documentation, but that is all I can find that is helpful.

The problem with this is that most of the instances started are fine and I'm not sure that getting 100 of them and then looking through then isn't the most useful.

I also found SP.WorkflowInstanceService.countInstancesWithStatus(parentSubscription,status) With this I at least can find out for each subscription how many suspended instance there are...and if none I don't have to try and track them down.

Is there a way using JSOM or REST to find only workflow instances with a specific internal status? Or do I have to grab batches of 100, filter for the status, and repeat until I've found them all?

  • I have done it using PowerShell as well as CSOM. where I deleted all completed workflow instances. but I am not sure whether it is possible using REST, JSOM or not. – Negi Rox Dec 29 '17 at 7:26
  • What you could do is query the workflow history list. I create a separate history list for every workflow. EventType column has a number. Number Event Type spjeff.com/2010/01/29/… 0 None 6 TaskCompleted 5 TaskCreated 9 TaskDeleted 7 TaskModified 8 TaskRolledBack 3 WorkflowCancelled 11 WorkflowComment 2 WorkflowCompleted 4 WorkflowDeleted 10 WorkflowError 1 WorkflowStarted – Peter Mendez Oct 2 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.