cancel
Showing results for 
Search instead for 
Did you mean: 

how to assign tasks to all users.

bruce_peng
Champ in-the-making
Champ in-the-making
i have created a custom workfolw, for now each step task i use hard code in processdefinition.xml file, like:
    <swimlane name="scanning">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{people.getPerson("scanner")}</actor>  //——–at here i use had code
      </assignment>   
    </swimlane>
…  ….
    <swimlane name="qc">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{people.getPerson("qc")}</actor>    //——–at here i use had code
      </assignment>   
    </swimlane>
… …
but i don't want the hard code, you see it is very bad.i want dynamic replace the hard code.

maybe i will do somethings like this:the Administrator or workflowManager can set or change the all peoples who will to do the each step task at one page.

i am an new alfresco guys,  i don't how to implement (replace the hard codes). so please give some suggests. how can i do that?
i am sorry for my bad English! Smiley Happy
1 REPLY 1

jwrobel
Champ in-the-making
Champ in-the-making
Hey Bruce,
From what I gather you are trying to get the initiator of the workflow to select several assignees, right? To do that you need to create a few files in tomcat/webapps/alfresco/WEB-INF/classes/alfresco/:
1. workflowname/processdefinition.xml (this holds the flow of your workflow)
2. model/customWorkflowModel.xml  (this holds the data/properties of your workflow)
3. custom-model-context.xml (this tells alfresco about the model)
4. custom-web-client-context.xml (this tells the alfresco web client how and what to display)
Also,
There are a variety of ways to deploy the workflow: workflow-console, jBPM Graphical Process Designer, or extend workflowbootstrap. jBPM Graphical Process Designer is the quickest.

Now to answer your question, specifically:
processdefinition.xml:


<swimlane name="initiator" />

<start-state name="start-state1">
      <task name="wfns:doSomething" swimlane="initiator" />
      <transition to="tran"></transition>
</start-state>

<swimlane name="scanning">
   <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
      <actor>#{wfns_scannerPerson}</actor>
   </assignment>
</swimlane>
<swimlane name="qc">
   <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
      <actor>#{wfns_qcPerson}</actor>
   </assignment>
</swimlane>

First, you need use a <start-state> node. The <start-state> node signifies the begining of the workflow. Inside the <start-state> is a task. the task is described in modelname-content-model.xml.

customWorkflowModel.xml:


<type name="wfns:doSomethign">
   <parent>bpm:startTask</parent>
      <properties>
         <property name="wfns:scannerPerson">
            <type>cm:person</type>
            <mandatory>false</mandatory>
            <multiple>false</multiple>
         </property>
         <property name="wfns:qcPerson">
               <type>cm:person</type>
               <mandatory>false</mandatory>
               <multiple>false</multiple>
         </property>
      </properties>
</type>

modelname-content-model.xml we have defined two properties as cmSmiley Tongueerson data types.

custom-model-context.xml:

<beans>
   <!– Registration of new models –>
   <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
            <value>alfresco/extension/model/customWorkflowModel.xml</value>
         </list>
      </property>
   </bean>   
</beans>
custom-model-context.xml is a pretty vanilla file. In the dictionaryBootstrap bean we tell alfresco where to find the model.


custom-web-client-context.xml :


<alfresco-config>
    <config evaluator="node-type" condition="wfns:doSomethign" replace="true">
        <property-sheet>
            <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
            <show-property name="wfns:scannerPerson"  />
            <show-property name="wfns:qcPerson" />
        </property-sheet>
    </config>
</alfresco-config>

The web-client automatically does some default stuff, but we don't care. thats what that replace="true" is about. Everything else tells alfresco to display stuff.

-Justin