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?