Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I used packageContains association to find workflows for document. Below i posted code in Alfresco JavaScript for active workflows (as zladuric answered) and also for all workflows:</p> <pre class="lang-js prettyprint-override"><code>/*global search, logger, workflow*/ var getWorkflowsForDocument, getActiveWorkflowsForDocument; getWorkflowsForDocument = function () { "use strict"; var doc, parentAssocs, packages, packagesLen, i, pack, props, workflowId, instance, isActive; // doc = search.findNode("workspace://SpacesStore/8847ea95-108d-4e08-90ab-34114e7b3977"); parentAssocs = doc.getParentAssocs(); packages = parentAssocs["{http://www.alfresco.org/model/bpm/1.0}packageContains"]; // if (packages) { packagesLen = packages.length; // for (i = 0; i &lt; packagesLen; i += 1) { pack = packages[i]; props = pack.getProperties(); workflowId = props["{http://www.alfresco.org/model/bpm/1.0}workflowInstanceId"]; instance = workflow.getInstance(workflowId); /* instance is org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance */ isActive = instance.isActive(); logger.log(" + instance: " + workflowId + " (active: " + isActive + ")"); } } }; getActiveWorkflowsForDocument = function () { "use strict"; var doc, activeWorkflows, activeWorkflowsLen, i, instance; // doc = search.findNode("workspace://SpacesStore/8847ea95-108d-4e08-90ab-34114e7b3977"); activeWorkflows = doc.activeWorkflows; activeWorkflowsLen = activeWorkflows.length; for (i = 0; i &lt; activeWorkflowsLen; i += 1) { instance = activeWorkflows[i]; /* instance is org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance */ logger.log(" - instance: " + instance.getId() + " (active: " + instance.isActive() + ")"); } } getWorkflowsForDocument(); getActiveWorkflowsForDocument(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload