2

I have trouble starting workflows with JSOM. The first case causes errors only for some users mostly on Wi-Fi First case is :

var servicesManager = new         SP.WorkflowServices.WorkflowServicesManager(context, web);
var subscriptions = servicesManager.getWorkflowSubscriptionService().enumerateSubscriptionsByList(ListGUId);
context.load(servicesManager);
context.load(subscriptions);
context.executeQueryAsync(succesFunction, failFunction);

this throws

"Invalid querry Exception : Invalid request"

Now I'm using:

var servicesManager = new SP.WorkflowServices.WorkflowServicesManager(context, web);
var workflowDeploymentService = servicesManager.getWorkflowDeploymentService();
var publishedWorkflowDefinitions = workflowDeploymentService.enumerateDefinitions(true);
context.load(servicesManager);
context.load(publishedWorkflowDefinitions);
context.executeQueryAsync(function (sender, args) {
var workflowGUId = publishedWorkflowDefinitions.get_data()[0].get_id(); 
var workflowSub = servicesManager.getWorkflowSubscriptionService().enumerateSubscriptionsByDefinition(workflowGUId);
context.load(workflowSub);
context.executeQueryAsync(succesFunction, failFunction);
},failFunction);

And this one gives me

"Unauthorised error"

and can be successfuly run only with Full Control or Design permissions.

Can is solve this somehow without using SPService?

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.