We have workflows running on several different lists in a site. Occasionally an item will suspend due to either something wrong with our farm (I'm not a central admin just a site collection admin) or an unhandled/unhandleable error with the workflow. As best I can tell there is no way to see suspended list workflows easily -- I have to go to each item in the list (hundereds), click the ellipsis, workflows, and see if they are suspended.
I'd like to find a javascript (REST preferred but also JSOM) that can check all the list workflows. I've googled and found a lot of tutorials on how to start a workflow using REST.
I've also found a lot of tutorials on how to read the Status column, but that is not updated when workflow is terminated or suspended. So that can't help me. I need to be able to read the internal status.
I found this REST endpoint (POST).
_api/SP.WorkflowServices.WorkflowInstanceService.Current/EnumerateInstancesForSite()
And that seems to work for the site workflows, but I can't find any documentation for how to get the instance for a list item.
I found this msdn documentation which has methods like Enumerate(WorkflowSubscription)
or EnumerateInstancesForListItem(ListGuid,ItemId)
. But those don't seem to be available from REST.
I have used the following endpoint to see the workflows that are enabled on my list.
_api/SP.WorkflowServices.WorkflowSubscriptionService.Current/EnumerateSubscriptionsByList('guid in here')
I get Id, DefinitionId, and EventSourceId. I assume Id is the one I want and then I tried
/_api/SP.WorkflowServices.WorkflowInstanceService.Current/Enumerate('guid in here')
But that returned The method Enumerate cannot be invoked as its parameter parentSubscription is not supported. I also tried the other guids with the same results.
Anybody know how to do this? Will I have to do it with JSOM? If so can you recommend documentation for that?
EDIT
SP 2013 on prem