cancel
Showing results for 
Search instead for 
Did you mean: 

start custom workflow using action execute script

himanshuk4u
Champ in-the-making
Champ in-the-making
Hi, i am new to alfresco
I want to create a rule, with the "execute a script" actions. I want to start the advanced workflow with the help of the rules.
i have created workflow using activiti and in alfresco share by default in rules execute script is showing only start pooled review and approve workflow .
how can i display my custom workflow ?
how i can create my custom action ?
where i should create javascript to perform an action so that document i attach to workflow get copied/moved to 'approved' folder i created in user homes/himanshu/approved


Thank You

Himanshu Kapoor
Dell International Services
17 REPLIES 17

mitpatoliya
Star Collaborator
Star Collaborator
No Koopa, AFAIK there is nothing you could do about it.
I have also come across this issues once but could not find anything which helps.
Also if you customize the UI to fetch the scripts from class path you need to do it for explorer and share seperatly

himanshuk4u
Champ in-the-making
Champ in-the-making
hi All

thank you for your reply….

i have created trigerMyWorkflow.js


   var workflow = actions.create("start-workflow");
   workflow.parameters.workflowName = "activiti$dm:marketReview";
   workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
   workflow.parameters["bpm:assignee"] = "admin";
   var futureDate = new Date();
   futureDate.setDate(futureDate.getDate() + 7);
   workflow.parameters["bpm:workflowDueDate"] = futureDate;
   workflow.execute(document);

and placed in company home->data dictionary->Scripts

but it is showing err..

ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 03230089 Failed to execute script 'workspace://SpacesStore/a354a191-bf06-45fa-a6be-de944df45179': null

Caused by: java.lang.NullPointerException


my workflow is working in share.

Could be that document is null. I'm already facing the same issue

mitpatoliya
Star Collaborator
Star Collaborator
Yes, document object will only be available if you are invoking script on rule based on document related events like incoming of document,update of document etc… otherwise you will get it null in the context.

himanshuk4u
Champ in-the-making
Champ in-the-making
hi

I have applied above rule to folder and while trying to upload any doc its giving 'null'.
still problem not resolved.

himanshuk4u
Champ in-the-making
Champ in-the-making
HI guys

sry i was doing one mistake , in my share-workflow-form-config file i have written

<config evaluator="string-compare" condition="activiti$marketReview">

and  was using

workflow.parameters.workflowName = "activiti$dmsc:marketReview";

instead of

workflow.parameters.workflowName = "activiti$marketReview";

in js file
now my workflow is trigger but document attached to it does not appear to other user other than admin

workflow.parameters["bpm:assignee"] = "admin"; ===> the wokflow is assigned to only 'admin' user.So how do you like that the document appear to other user than admin?

Hi

i want all reviewers present in wf process definition can view document , so do i have to give all the assignees in workflow.parameters [] which are present in process definition ?