cancel
Showing results for 
Search instead for 
Did you mean: 

Web script - how to iterate ScriptableHashMap?

morf3usz
Champ in-the-making
Champ in-the-making
Hi,

Does anyone know, how to iterate the ScriptableHashMap in Alfresco Web script? I have the following construction:

var projects = webprojects.listWebProjects();
var project;

for (var i = 0; i < projects.length; i++) {
    if (projects[i].getName() == 'HbbTV') {
        project = projects[i];
        break;
    }
}

var sand = project.getSandboxes(); // <—– according to documentation, here is ScriptableHashMap
When now I try to call :

sand.getIds();
the webscript complains:
TypeError: getIds is not a function, it is null
Does anybody know how what to do with that?
2 REPLIES 2

chicco0386
Champ on-the-rise
Champ on-the-rise
Hi,
sorry but I don't have the solution, but I'm searching for the solution because I've the same problem with this code:
function signal(workflowPath){
    var workflowTasks = workflowPath.getTasks();
    var currentTask;
    var taskTransition;
    var currentTaskTransition;
    for (var i=0; i<workflowTasks.length; i++){
        currentTask = workflowTasks[i];
        taskTransition = currentTask.getTransitions();
        logger.log("signal, dal task ["+currentTask.getName()+"] parte ["+taskTransition.length+"] transition");
        currentTaskTransition = taskTransition.getIds();
    }
}


Have you found the solution?

THANK YOU

cmcmillen1
Champ in-the-making
Champ in-the-making
I know this is an old post but I had the same question so I figured I'd post a solution in case someone else stumbles upon this.

Basically, the solution is to use a for..in loop.  Using OP's code…



var sand = project.getSandboxes();
for (var index in sand) {
    var sandbox = sand[index];
    …
}