cancel
Showing results for 
Search instead for 
Did you mean: 

Starting workflow automatically

muralidharand
Star Contributor
Star Contributor
Hi experts,

I want to start my custom workflow whenever a document is uploaded into a document library.
During the workflow development, I want to specify the user groups also (who can approve or reject the workflow).
Please help me.
8 REPLIES 8

mitpatoliya
Star Collaborator
Star Collaborator
You need to divide your req in two part

Starting workflow on document upload : this can be done via script and rule

Develop a custom workflow: Develop advance workflow with user defined review group.

muralidharand
Star Contributor
Star Contributor
How to custom define the custom while designing the workflow?
You meant to say, just metioning the group name in the properties of the task.

muralidharand
Star Contributor
Star Contributor
Yes, the following script can be used to start the particular workflow.

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReview";
workflow.parameters["bpm:workflowDescription"] = "Please assign approver for "+ document.name;
workflow.parameters['bpm:assignee']=people.getPerson("username");
workflow.parameters["sendEMailNotifications"] = false;
workflow.execute(document);

mitpatoliya
Star Collaborator
Star Collaborator
Yes you are done with first step now just second is remaining  😎

muralidharand
Star Contributor
Star Contributor
For the second question, I have selected "CandiateGroups' from "performer type" drop down and in the expression, i have used workflow variable.

Perform type : candidate groups
Expression : ${wf_accounts_group_name}

Is it possible here to directly specifiy the group name something like, "GROUP_ACCOUNTS" or "GROUP_PURCHASE" ? Because, when I hard code the group name, it is not working.

Please suggest me.

cool123
Champ in-the-making
Champ in-the-making
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReview";
workflow.parameters["bpm:workflowDescription"] = "Please assign approver for "+ document.name;
workflow.parameters['bpm:assignee']=people.getPerson("username");
workflow.parameters["sendEMailNotifications"] = false;
workflow.execute(document);


where i have to add this code, in bpmn file or in the javascript file

eduardom
Champ in-the-making
Champ in-the-making
I want to do the same but I don't know where you should put myownrule.js in order to could be viewed from Alfresco Share when you choose: add a new rule in a folder + execute script.

In fact, when I choose execute script, only is showed a pre-defifinid workflow "Start workflow review and Approved" and it doesn't work.

wkyiskevin
Champ in-the-making
Champ in-the-making
Put your js file in under Data Dictionary/Scripts so that you will be able to see it when creating a rule via UI