AnsweredAssumed Answered

Getting a list of workflows relating to a user by JavaScript

Question asked by egor on Aug 18, 2017
Latest reply on Aug 18, 2017 by egor

Hi, please help.

 

I searched information in the Internet but no success. I have the following challenge.

 

How I can get a list of workflows relating to a user by simple JavaScript script  (which we plan to use as rule in future). If possible please provide a full source code.

 

I know how to get a list of workflows by RESTful: 

http://localhost:8080/alfresco/service/api/workflow-instances 

 but I do not know how we can call it from simple JavaScript ?!

 

I tried to use "remote" object in JavaScript Console (by Florian Maul) but system reported the "remote is not defined":

var url = "http://localhost:8080/alfresco/service/api/workflow-instances";
var json = remote.call(url);

 

I also know how to get a workflow relating to some file(s) but that's not what I'm looking for:

var docNodeRef = "workspace://SpacesStore/c86cbdb5-6bbc-4a30-8c8d-be610bee4a63";
var theDocument = search.findNode(docNodeRef);

for each(wf in theDocument.activeWorkflows)
{
logger.log(wf.);
}

 

So I need to get a list of all workflows relating to a some user by simple JavaScript script from user session. We plan to place this script file in "Repository -> Data Dictionary -> Scripts" and use it in Alfresco' Rule.

 

Thank you very much in advance for any help!

 

Best regards,

Egor

Outcomes