cancel
Showing results for 
Search instead for 
Did you mean: 

Assign a task to a group

bgl
Champ on-the-rise
Champ on-the-rise
Hi,

I would like to assign a task to a group of persons. Task could then be handled by one of the group.

But it does not seem possible in the user interface of Alfresco. Did I miss something ?

I know this is possible in jBPM since it is written in their documentation  :wink: . Is this feature supported by Alfresco ? or do I need to code something ?

Thank you

Boris
14 REPLIES 14

davidc
Star Contributor
Star Contributor
If you're referring to jBPM Pooled tasks, then they are exposed in Alfresco.  There are further workflow definitions in

workflow-context.xml.sample

residing in

config/alfresco/extension

One of the definitions demonstrates pooled tasks - review_pooled_processdefinition.xml.

Just take off the .sample extension and re-start the server.

You'll also need to add the 'My Pooled Tasks' dashlet to the dashboard.

bgl
Champ on-the-rise
Champ on-the-rise
Hi David,

Thanks a lot for your answer. That's almost what I was looking for.

I see new now those features in advanced workflow:
Parallel Review & Approve (Parallel Review & approval of content)
Group Review & Approve (Group review & approval of content)
Review & Approve (Review & approval of content)
Pooled Review & Approve (Pooled review & approval of content)
Adhoc Task (Assign task to colleague)

So there is no way, out of the box, to assign a task to a group or a pool of actors if I understand well. If I want this I have to write it. Is that right ?

I've played around with group and pool feature. They are great but I saw a problem. I post a new thread about it since it is a new topic.

Boris

davidc
Star Contributor
Star Contributor
So there is no way, out of the box, to assign a task to a group or a pool of actors if I understand well. If I want this I have to write it. Is that right ?

Perhaps you could clarify your requirement here.  Do you mean you'd like to assign an ad-hoc task a group or pool?

bgl
Champ on-the-rise
Champ on-the-rise
Yes it is exactly this.

I would like to delegate some tasks to persons that are part of a group. So I wanted to use ad-hoc tasks to do this.

Do you see another way to do this ?

Thanks

Boris

davidc
Star Contributor
Star Contributor
If that's the process you require, then that's the process.  Alfresco allows you to define your own processes, so I took the out-of-the-box adhoc process and converted it to a pooled adhoc process.

Create the following files in your config/alfresco/extension directory:

1) adhocgroup_processdefinition.xml

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfag:adhocgroup">

   <swimlane name="initiator"/>

   <start-state name="start">
      <task name="wfag:submitAdhocGroupTask" swimlane="initiator"/>
      <transition name="" to="adhoc"/>
   </start-state>

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
        <pooledactors>#{bpm_groupAssignee}</pooledactors>
      </assignment>
   </swimlane>
  
   <task-node name="adhoc">
      <task name="wf:adhocTask" swimlane="assignee">
         <event type="task-create">
            <script>
               if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
               if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
            </script>
         </event>
          <event type="task-end">
             <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_assignee" access="write"/>
                   <expression>
                      if (taskInstance.actorId == undefined)
                         person;
                      else
                         people.getPerson(taskInstance.actorId);
                   </expression>
                </script>
             </action>
          </event>
      </task>
      <transition name="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (wfag_notifyMe)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done";
                 mail.execute(bpm_package);
              }
           </script>
         </action>
      </transition>
   </task-node>
  
   <task-node name="completed">
      <task name="wf:completedAdhocTask" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>
     
   <end-state name="end"/>
  
</process-definition>

2) adhocgroup-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <bean id="adhoc.group.workflowBootstrap" parent="workflowDeployer">
      <property name="workflowDefinitions">
         <list>
            <props>
               <prop key="engineId">jbpm</prop>
               <prop key="location">alfresco/extension/adhocgroup_processdefinition.xml</prop>
               <prop key="mimetype">text/xml</prop>
               <prop key="redeploy">false</prop>
            </props>
         </list>
      </property>
      <property name="models">
         <list>
               <value>alfresco/extension/adhocgroupModel.xml</value>
         </list>
      </property>
      <property name="labels">
         <list>
               <value>alfresco/extension/adhocgroup-messages</value>
         </list>
      </property>
   </bean>

</beans>

3) adhocgroup-messages.properties

#
# Adhoc Task Workflow
#

wfag_adhocgroup.workflow.title=Adhoc Group Task
wfag_adhocgroup.workflow.description=Assign task to a pooled group

# Adhoc Task Definitions

wfag_adhocgroupworkflowmodel.type.wfag_submitAdhocGroupTask.title=Start Adhoc Group Task
wfag_adhocgroupworkflowmodel.type.wfag_submitAdhocGroupTask.description=Allocate task to a pooled group
wfag_adhocgroupworkflowmodel.property.wfag_notifyMe.title=Notify Me
wfag_adhocgroupworkflowmodel.property.wfag_notifyMe.description=Notify me when task is complete

4) adhocgroupModel.xml

<?xml version="1.0" encoding="UTF-8"?>

<model name="wfag:adhocgroupworkflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>
   </imports>

   <namespaces>
      <namespace uri="http://www.alfresco.org/model/adhocgroupworkflow/1.0" prefix="wfag"/>
   </namespaces>
     
   <types>

      <!–                               –>
      <!–  Adhoc Group Tasks –>              
      <!–                               –>
     
      <type name="wfag:submitAdhocGroupTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="wfag:notifyMe">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>bpm:groupAssignee</aspect>
         </mandatory-aspects>
      </type>

   </types>
  
</model>

5) web-client-config-custom.xml

<alfresco-config>

   <config evaluator="node-type" condition="wfag:submitAdhocGroupTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="wf_adhoc_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="wf_adhoc_due_date" />
         <show-property name="wfag:notifyMe" />
         <separator name="sep2" display-label-id="user_filter_user" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:groupAssignee" display-label-id="wf_adhoc_assign_to" />
      </property-sheet>
   </config>

</alfresco-config>

bgl
Champ on-the-rise
Champ on-the-rise
Thanks a lot !

This is really great. I try them and post back about it.

bgl
Champ on-the-rise
Champ on-the-rise
One word: perfect !

Thanks a lot David !

giorgio
Champ in-the-making
Champ in-the-making
Well, you can help me? I am trying to create a workflow or modify one that already exists, so that once established, can reassign the task to multiple users or multiple groups, by default only allows Alfresco to reassign a user.

Thanks and regards

giorgio
Champ in-the-making
Champ in-the-making
If that's the process you require, then that's the process.  Alfresco allows you to define your own processes, so I took the out-of-the-box adhoc process and converted it to a pooled adhoc process.

Create the following files in your config/alfresco/extension directory:

1) adhocgroup_processdefinition.xml

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfag:adhocgroup">

   <swimlane name="initiator"/>

   <start-state name="start">
      <task name="wfag:submitAdhocGroupTask" swimlane="initiator"/>
      <transition name="" to="adhoc"/>
   </start-state>

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
        <pooledactors>#{bpm_groupAssignee}</pooledactors>
      </assignment>
   </swimlane>
  
   <task-node name="adhoc">
      <task name="wf:adhocTask" swimlane="assignee">
         <event type="task-create">
            <script>
               if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
               if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
            </script>
         </event>
          <event type="task-end">
             <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_assignee" access="write"/>
                   <expression>
                      if (taskInstance.actorId == undefined)
                         person;
                      else
                         people.getPerson(taskInstance.actorId);
                   </expression>
                </script>
             </action>
          </event>
      </task>
      <transition name="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (wfag_notifyMe)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done";
                 mail.execute(bpm_package);
              }
           </script>
         </action>
      </transition>
   </task-node>
  
   <task-node name="completed">
      <task name="wf:completedAdhocTask" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>
     
   <end-state name="end"/>
  
</process-definition>

2) adhocgroup-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <bean id="adhoc.group.workflowBootstrap" parent="workflowDeployer">
      <property name="workflowDefinitions">
         <list>
            <props>
               <prop key="engineId">jbpm</prop>
               <prop key="location">alfresco/extension/adhocgroup_processdefinition.xml</prop>
               <prop key="mimetype">text/xml</prop>
               <prop key="redeploy">false</prop>
            </props>
         </list>
      </property>
      <property name="models">
         <list>
               <value>alfresco/extension/adhocgroupModel.xml</value>
         </list>
      </property>
      <property name="labels">
         <list>
               <value>alfresco/extension/adhocgroup-messages</value>
         </list>
      </property>
   </bean>

</beans>

3) adhocgroup-messages.properties

#
# Adhoc Task Workflow
#

wfag_adhocgroup.workflow.title=Adhoc Group Task
wfag_adhocgroup.workflow.description=Assign task to a pooled group

# Adhoc Task Definitions

wfag_adhocgroupworkflowmodel.type.wfag_submitAdhocGroupTask.title=Start Adhoc Group Task
wfag_adhocgroupworkflowmodel.type.wfag_submitAdhocGroupTask.description=Allocate task to a pooled group
wfag_adhocgroupworkflowmodel.property.wfag_notifyMe.title=Notify Me
wfag_adhocgroupworkflowmodel.property.wfag_notifyMe.description=Notify me when task is complete

4) adhocgroupModel.xml

<?xml version="1.0" encoding="UTF-8"?>

<model name="wfag:adhocgroupworkflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>
   </imports>

   <namespaces>
      <namespace uri="http://www.alfresco.org/model/adhocgroupworkflow/1.0" prefix="wfag"/>
   </namespaces>
     
   <types>

      <!–                               –>
      <!–  Adhoc Group Tasks –>              
      <!–                               –>
     
      <type name="wfag:submitAdhocGroupTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="wfag:notifyMe">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>bpm:groupAssignee</aspect>
         </mandatory-aspects>
      </type>

   </types>
  
</model>

5) web-client-config-custom.xml

<alfresco-config>

   <config evaluator="node-type" condition="wfag:submitAdhocGroupTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="wf_adhoc_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="wf_adhoc_due_date" />
         <show-property name="wfag:notifyMe" />
         <separator name="sep2" display-label-id="user_filter_user" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:groupAssignee" display-label-id="wf_adhoc_assign_to" />
      </property-sheet>
   </config>

</alfresco-config>

Well, you can help me? I am trying to create a workflow or modify one that already exists, so that once established, can reassign the task to multiple users or multiple groups, by default only allows Alfresco to reassign a user. im spanish user you are spanish david?

Thanks and regards