cancel
Showing results for 
Search instead for 
Did you mean: 

Get users from the workflow

pp20218
Champ in-the-making
Champ in-the-making
Hi,

I am running the advanced workflow automatically from a space. I have the Java script that executes after a content is added to the space. My JS code is as below.

var workflow = actions.create("start-workflow");
workflow.parameters["bpm:assignee"] = person;

Here person stands per the current user. But my requirement is I have to send to a particular user. Consider I have a Group "DEVELOPER" with 5 members in the group.

So how can I get the value of this group("DEVELOPER"); instead of "person"

Thanks
PP
15 REPLIES 15

zaizi
Champ in-the-making
Champ in-the-making
groups.getGroup("Group_DEVELOPER");

Ainga

pp20218
Champ in-the-making
Champ in-the-making
Hi,
Thanx for the reply. But the code is not working.I am getting the error. When I am selecting "person" it is working as expected.
code for "person"
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = document.name;
workflow.parameters["bpm:assignee"] =person;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);


for the group
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = document.name;
var approveUsers=groups.getGroup("Group_DEVELOPER");
workflow.parameters["bpm:assignee"] =approveUsers;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);


NOTE: I am having a group called "Group_DEVELOPER" in alfresco.
I am getting the below error
A system error happened during the operation: 07030003 Failed to execute script 'workspace://SpacesStore/8359491b-afa2-426e-97f8-4cff5462af09': 07030002 Failed to signal transition 'null' from workflow task 'jbpm$107' when I upload a document in Out of Box.  I checked the error in log.

Caused by: org.alfresco.service.cmr.workflow.WorkflowException: 07030002 Failed to signal transition 'null' from workflow task 'jbpm$107'
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.endTask(JBPMEngine.java:1742)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:544)
…….
…..


aused by: org.jbpm.graph.def.DelegationException: 07030001 actor expression must evaluate to a person
   at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:298)
   at org.jbpm.taskmgmt.exe.TaskMgmtInstance.getInitializedSwimlaneInstance(TaskMgmtInstance.java:260)
   at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:202)
   ……………
………………..
…………


Caused by: org.alfresco.service.cmr.workflow.WorkflowException: 07030001 actor expression must evaluate to a person
   at org.alfresco.repo.workflow.jbpm.AlfrescoAssignment.assign(AlfrescoAssignment.java:113)
   at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignmentDelegation(TaskMgmtInstance.java:320)
   at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:274)
   … 196 more

Please provide me the solution.
Thanx

thestorm
Champ in-the-making
Champ in-the-making
var approveUsers=groups.getGroup("Group_DEVELOPER");
workflow.parameters["bpm:groupAssignee"] =approveUsers;

u need a group Smiley Wink

pp20218
Champ in-the-making
Champ in-the-making
Hi,
Thanks for the reply.
Now the error is gone but the workflow is not getting initiated.

I have the below js code(This gets executed when a content is added to the space)

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = document.name;
var approveUsers=groups.getGroup("Group_DEVELOPER");
workflow.parameters["bpm:groupAssignee"] =approveUsers;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);

I am executing the Approve/reject workflow. So when the content is uploaded the workflow is not initiated.
Please provide me your thoughts.

Thanx in adv.

vinaxwater
Champ in-the-making
Champ in-the-making
Hi friend,

change this code:

var approveUsers = groups.getGroup("Group_DEVELOPER");

with below code for respone people assign:

var approveUsers = people.getGroup("Group_DEVELOPER");

good luck!

Regards
vinaxwater

pp20218
Champ in-the-making
Champ in-the-making
Hi,
Thanx for your reply. After I changed the code, I am getting the below error oin the screen
A system error happened during the operation: 07040017 Failed to execute script 'workspace://SpacesStore/0ac35339-64a4-4f39-8e63-9911cb89aa5b': 07040016 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}assignee

In the log

Caused by: org.alfresco.service.cmr.workflow.WorkflowException: 07040016 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}assignee
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$26.doInJbpm(JBPMEngine.java:1712)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
……………..
………………
………………..


This is what I got before also.
Can anyone help me out?

Thanx

pp20218
Champ in-the-making
Champ in-the-making
Can anyone help me out please!!

Thanx

vinaxwater
Champ in-the-making
Champ in-the-making
Hi friend,
You can get all member in group then use bpm_assignee normal:

var members = people.getMembers(people.getGroup("GROUP_DEVELOPER"));
You can loop Array members normal

good luck
vinaxwater

pp20218
Champ in-the-making
Champ in-the-making
Hi vinaxwater,

Thanx for the reply.
Below is my code

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = document.name;
var members = people.getMembers(people.getGroup("GROUP_DEVELOPER"));
workflow.parameters["bpm:assignee"] =members;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.execute(document);


But I am getting the below error.
A system error happened during the operation: 07050025 Failed to execute script 'workspace://SpacesStore/0ac35339-64a4-4f39-8e63-9911cb89aa5b': Group is a mandatory parameter


Can you please provide me the solution.If possible share me any doc related to this API.

Thanx in adv.