cancel
Showing results for 
Search instead for 
Did you mean: 

Predefined assignees on workflow tasks

alejandrosl
Champ in-the-making
Champ in-the-making
Hi,

when a custom advanced workflow is used, is it possible  to have a preselected assignee in every task? I mean, instead of having to choose the user the task is assigned to in the task page, finding a predefined user (editable or not) in that page. If all workflow steps have to be taken always by the same users in the same sequencial order, it would be very suitable.

As an alternative, could assignees be selected among a restricted list of users, i.e. the ones who take part into the workflow and not all Alfresco users?  For example, from a drop-down list.
5 REPLIES 5

zladuric
Champ on-the-rise
Champ on-the-rise
when a custom advanced workflow is used, is it possible  to have a preselected assignee in every task?
Yes, you can define assignees with <swimlane> in workflow definitions.
Then for specific tasksy just set the swimlane you want.
I mean, instead of having to choose the user the task is assigned to in the task page, finding a predefined user (editable or not) in that page. If all workflow steps have to be taken always by the same users in the same sequencial order, it would be very suitable.
You can define multiple swimlanes for that workflow, then assign a swimlane for each task-node you have.
As an alternative, could assignees be selected among a restricted list of users, i.e. the ones who take part into the workflow and not all Alfresco users?  For example, from a drop-down list.
Not sure how, but I'm pretty sure it can be done.

alejandrosl
Champ in-the-making
Champ in-the-making
Zlatko, thanks for your quick answer. I've already defined several swimlanes and their tasks for my workflow, like this:

<swimlane name="assignee2">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee2}</actor>
      </assignment>
</swimlane>

<task-node name="Task name">
      <task name="proced:anytask" swimlane="assignee2" />
      <transition to="Next Node">
      …
      </transition>
</task>

Do you mean that I can change #{bpm_assignee2} for an Alfresco username? And do I have to made changes also in workflow model and web-client-config-custom.xml?

zladuric
Champ on-the-rise
Champ on-the-rise
You don't have to change anything in the workflow model.

You can put in <actor> a username (literal, no quotes or anything, for example: <actor>zduric</actor>).

Or you can pick it up from somewhere (so you don't have to redeploy the workflow if you change users around) like this:
if the "document" has the "owner assoc"
<actor>#{people.getPerson(bpm_package.children[0].assocs["someco:DocumentOwner"][0].properties.userName)}</actor>
or pick it from some configuration node or similar.

alejandrosl
Champ in-the-making
Champ in-the-making
Thanks again Zlatko. Before the changes that I need to make my workflow was running perfectly. I've tried the changes you suggested me but I'm still missing something. I asked about task model and web-client-config-custom.xml because in the task model I have defined aspects like this one:

<aspect name="bpm:assignee2">
            <associations>

                <association name="bpm:assignee2">
                    <source>
                        <mandatory>false</mandatory>
                        <many>false</many>
                    </source>
                    <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                    </target>
                </association>

            </associations>
        </aspect>

And there also the tasks with mandatory aspects:

<type name="proced:revisarDir"> 
    <parent>proced:base</parent>
      <overrides>
        <property name="proced:nombre"></property>
        …
      </overrides>           
      <mandatory-aspects>
         <aspect>bpm:assignee2</aspect>
      </mandatory-aspects>
    </type>

And in web-client-config.custom.xml:

<config evaluator="node-type" condition="proced:revisarDir" replace="true">
    <property-sheet>
      <show-property name="proced:nombre" display-label="Nombre" read-only="true" show-in-edit-mode="true"/>
      …    
      <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator"/>
      <show-association name="bpm:assignee2" display-label="Task assigned to:" />
    </property-sheet>
   </config>

If I only change <actor>#{bpm_assignee2}</actor> for <actor>username</actor> as you told, no change happens: I still have to select the user the task will be assigned to. What else should I do?

wimschreurs
Champ in-the-making
Champ in-the-making
Hi,

You have to remove the mandatory aspect from your model and in web-client-config.xml. You don't want a user picker, you want to hard-code an actor in a swimlane.

As an alternative, could assignees be selected among a restricted list of users, i.e. the ones who take part into the workflow and not all Alfresco users? For example, from a drop-down list.

You can do this in Java. You would have to code a custom Generator class (a subclass of org.alfresco.web.bean.generator.BaseComponentGenerator). A good example would be Alfresco TextFieldGenerator. It has a method 'getListOfValuesConstraint'. You could change this method to have it return a list of users belonging to a certain group of users.