Is it possible to start workflows via JSOM in SharePoint Foundation 2013?
-
05-01-2021 - |
質問
I'm currently trying to start a list workflow via JSOM. The problem is that every time I receive the following error:
Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "GetWorkflowInteropService new Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager() "
I'm using a code similar to this one:
function fire2010WorkflowForListItems(ctx, listGuid, plainItems) {
var workflowServicesManager =
SP.WorkflowServices.WorkflowServicesManager.newObject(ctx,
ctx.get_web());
var service = workflowServicesManager.getWorkflowInteropService();
for(var i = 0; i < plainItems.length; i++) {
var plainItem = plainItems[i];
console.log('scheduling workflow for id: ', plainItem.id);
service.startWorkflow(options.workflowName, null,
listGuid, plainItem.guid, options.initiationParams);
}
console.log('now executing...');
ctx.executeQueryAsync(function() {
console.info('yes, workflows completed for '
+ items.length + ' items');
}, function() {
console.error('it didnt go well');
});
}
found here: https://chuvash.eu/2016/05/19/trigger-sp2010-workflows-using-jsom/
I've found, as well, this question, with a similar problem: (Solved) Start a Workflow of the Host-Web via SharePoint App and JSOM
The user solved it, partially, by going to Central Administration -> Application Management -> Manage service applications -> Workflow Service Application Proxy. Unfortunately, I can't find that option in my Central Administration.
I have SharePoint Foundation 2013.
In that case, my question is: Do I need Workflow Manager 1.0 in order to start workflows from JSOM? Is Workflow Manager available for Foundation? Or do I need the Server version? From these two results my main question: Is it possible to start a workflow, from JSOM, while having SharePoint Foundation 2013?
Thank you!
解決
Is it possible to start a workflow, from JSOM?
- Yes, it's possible.
Do I need Workflow Manager in order to start workflows from JSOM?
- Yes, Workflow Manager is a mandatory prerequisite to be able to Start workflow via JSOM. otherwise, you will get Null object when executing
SP.WorkflowServices.WorkflowServicesManager
Is Workflow Manager available for Foundation?
- Unfortunately, Workflow Manager is not available at SharePoint Foundation.
Or do I need the Server version?
- Yes, Workflow Manager is only available in both Standard and Enterprise Edition.