When you have the ID of a workflow then how do you find out what the name of the workflow is and where it's located. To simplify this search I have created this workflow.
You can download the workflow here.
This is the code of the scripting element that is used for the search:
//There is a shorter way of doing this, which is in an action from the vCAC plugin.
//Since not everyone has that plugin here is the code from that action. It's just two lines.
//var workflow = Server.getWorkflowWithId(id);
//System.log(workflow.name);
//I still use my solution because it's easier to get the path of the folder where the workflow is located
found = "No workflow found";
//I store the id in n attribute so that I can use it later in an input presentation for the user interaction
idToSearch = id;
//the following code comes from the action to export all workflows. I have modified it to muy needs.
var rootCats = Server.getAllWorkflowCategories();
for (var catIndex=0; catIndex < rootCats.length; catIndex++) {
allSubCategories(rootCats[catIndex]);
}
function allSubCategories(cat) {
if ( cat.workflows != null && cat.workflows.length > 0 ) {
for (var l=0; l < cat.workflows.length; l++) {
if (cat.workflows[l].id==id)
{
workflowName = cat.workflows[l].name;
workflowPath = cat.path;
workflowFound = true;
found = "Workflow found"; //used in the input presentation in the user interaction
}
}
}
var allCategories = cat.subCategories;
if (allCategories != null && allCategories.length > 0) {
for (var i=0; i < allCategories.length; i++) {
var allSubCats = allSubCategories(allCategories[i]);
}
}
}