SharePoint Online 2013. Trying to access SP.WorkflowServices.WorkflowServicesManager from NAPA (CSOM). Getting error : Cannot read property 'WorkflowServicesManager' of undefined
NAPA App is shared here : http://aka.ms/V8v2di
We've been able to access the class with PowerShell with no problem.
Here's the code in question:
(function () {
// Getting client context and loading the current web
var context = SP.ClientContext.get_current();
var web = context.get_web();
context.load(web);
// Workflow Services API entry point - WorkflowServiceManager object
var servicesManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web);
context.load(servicesManager);
var workflowDefinitions = servicesManager.getWorkflowDeploymentService().enumerateDefinitions(false);
context.load(workflowDefinitions);
context.executeQueryAsync(function (sender, args) {
// enumerateDefinition returns ClientCollection object
var definitionsEnum = workflowDefinitions.getEnumerator();
var empty = true;
console.log('Site ' + web.get_url() + ':');
// Going through the definitions
while (definitionsEnum.moveNext()) {
var def = definitionsEnum.get_current();
// Displaying information about this definition - DisplayName and Id
console.log(def.get_displayName() + " (id: " + def.get_id() + ")");
empty = false;
}