cancel
Showing results for 
Search instead for 
Did you mean: 

new js not visible in list 'execute script'

kay_be_
Champ in-the-making
Champ in-the-making
I added a simple js in 'data dictionary/scripts' folder.
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiAdhoc";
workflow.parameters["bpm:assignee"] = people.getPerson("valentine");
workflow.parameters["bpm:workflowDescription"] = "The attached document is uploaded in Alfresco, please review today.";
workflow.parameters["initiator"] = people.getPerson("kris");
var today = new Date();
var duedate = today.getDate() + 1;
workflow.parameters["bpm:workflowDueDate"] = duedate;
workflow.execute(document);
I named it advancedflow1.js and gave it a title. When I want to execute the script using a rule, the new js is not in the list. I already restarted Tomcat with no luck, file still isn't there. I don't think there is an error in the code and trying to rule that out I copied a piece of an example script into my advancedflow1.js but the file still does not appear. 
I'm using alfresco 4.0.c.
Is there anything I forgot? Can I flush caches in alfresco? Already flushed browser cache with no improvement.
Any advice on this is appreciated.
4 REPLIES 4

kay_be_
Champ in-the-making
Champ in-the-making
I found the mistake. I'll post it here so others that have the same problem have their solution.
When creating a script in the scripts folder you can choose between content types HTML, plain text and XML. I 've choosen plain text as I do creating websripts and I choose .js in the name. Unfortunately this is not enough. You have to edit the properties of the new script file (metadata) after creating the script and then you can change the content type and then: you have a whole bunch of types. Choose JS here and voila, you're done and your new javascript will appear in the execute script's list when creating a rule.  Smiley Very Happy

hsimonnot
Champ in-the-making
Champ in-the-making
It was very useful for me. Thanks

koopa
Confirmed Champ
Confirmed Champ
Jay this is good. Do you know how to add scripts on the classpath to the Execute Script action?

vijaypratapsing
Champ in-the-making
Champ in-the-making
i created script called transform.js and put in data dictionary –> script folder . but it is not working on executing the Action to call that script. predefined scripts are working.