cancel
Showing results for 
Search instead for 
Did you mean: 

Swimlanes

suleyman
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to make a script for selecting the actors automaticly and assigning them to the swimlanes.
Is het possible to write the usernames to variables and use the varibles at the swimlane assignment.

Like this:

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

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

   <swimlane name="initiator" />
        
   <start-state name="start">
        <task name="ovs:startaanvraag" swimlane="initiator">
      <event type="node-leave">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>                          
                  <expression>
                     
                     CoordinatorUser = "Bouw1";
                     
                     BouwUser = "Bouw1";
                     ReclameUser = "Reclame1";
                     InuitritUser = "Inuitrit1";
                     KapUser = "Kap1";
                     SloopUser = "Sloop1";                     
                  </expression>   
                  <variable name="CoordinatorUser" access="write" />
                  <variable name="BouwUser" access="write" />
                  <variable name="ReclameUser" access="write" />
                  <variable name="InuitritUser" access="write" />
                  <variable name="KapUser" access="write" />
                  <variable name="SloopUser" access="write" />                                    
               </script>
            </action>
         </event>       
        </task>
      <transition name="" to="ControleerAanvraag"></transition>
   </start-state>

  <swimlane name="coordinator">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
          <actor>#{people.getPerson(CoordinatorUser).properties["cm:userName"]}</actor>
      </assignment>
   </swimlane>
  
  <swimlane name="bouwadv">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
          <actor>#{BouwUser}</actor>
      </assignment>
   </swimlane>

………..

I'm getting the error message: org.mozilla.javascript.EcmaError: ReferenceError: "CoordinatorUser" is not defined. (AlfrescoScript#1)

Can anyone tell me why i'm getting this error.

Thanks in advance
20 REPLIES 20

pobe
Champ in-the-making
Champ in-the-making
For example when i start a review task, I have to select a reviewer to start the workflow. I want to have the reviewer pre-selected, but still get the opportunity to change reviewer.

/P

davidc
Star Contributor
Star Contributor
Start an advanced workflow via Javascript, and provide the workflow parameters such as reviewer, due date etc in the script.  This will, however, bypass the Start Workflow Wizard, so you can't edit the values (defined in the script) in the UI.

http://wiki.alfresco.com/wiki/WorkflowAdministration#Step_7:_Integration_with_Rules_.28Optional.29

pobe
Champ in-the-making
Champ in-the-making
Is there anyway you can do it so it is possible to edit the values in the UI?

/P

davidc
Star Contributor
Star Contributor
Not that I know of today.

jemurankolor
Champ in-the-making
Champ in-the-making
Start an advanced workflow via Javascript, and provide the workflow parameters such as reviewer, due date etc in the script.  This will, however, bypass the Start Workflow Wizard, so you can't edit the values (defined in the script) in the UI.

http://wiki.alfresco.com/wiki/WorkflowAdministration#Step_7:_Integration_with_Rules_.28Optional.29
Thanks david, but where should i write this script, i mean in what file should i write this script…

(Im newbie Smiley Happy )

jemurankolor
Champ in-the-making
Champ in-the-making
How to add another task node and assign this task to another user

rob562435
Champ in-the-making
Champ in-the-making
Well in fact I succeeded in "predefining" a user and having the possibility to change it later on. I created an aspect holding the various users in the workflow and associated that aspect to all workflow types in the model description.
<types>
<type name="qcp:mtSignOff">
  <parent>bpm:workflowTask</parent>
  <mandatory-aspects>
   <aspect>qcp:assignments</aspect>
  </mandatory-aspects>
</type>
</types>

<aspects>
<aspect name="qcp:assignments">
  <associations>
   <association name="qcp:mtApprover">
    <source>
     <mandatory>false</mandatory>
     <many>false</many>
    </source>
    <target>
     <class>cm:person</class>
     <mandatory>false</mandatory>
     <many>false</many>
    </target>
   </association>
  </associations>
</aspect>
</aspects>
Inside the workflow I added the following script:
 <start-state name="initiateCcr">
  <task name="qcp:initiateCcr" swimlane="initiator">
   <event type="task-create">
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
     <script>
      <variable name="qcp_mtApprover" access="write"/>
      <expression>
       qcp_mtApprover = people.getPerson("Francois Buijs");
      </expression>
     </script>
    </action>
   </event>
  </task>
Although I added this to the <task-create> event of the start-state, the default will be visible in the next workflow step (provided the visibility is regulated in the "web-client-config-custom.xml" file as shown below:
<config evaluator="node-type" condition="qcp:mtSignOff" replace="true">
<property-sheet>
  <separator name="sep1" display-label="General" component-generator="HeaderSeparatorGenerator"/>
   <show-property name="bpm:taskId" read-only="true"/>
   <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
   <show-property name="bpm:dueDate" read-only="true"/>
   <show-property name="bpm:priority" read-only="true"/>
   <show-property name="bpm:status"/>
  <separator name="sep2" display-label="Required metadata" component-generator="HeaderSeparatorGenerator"/>
   <show-property name="qcp:wfPlannedArpRelease" display-label="Planned ARP release"/>
  <separator name="sep3" display-label="Roles and assigned users" component-generator="HeaderSeparatorGenerator"/>
   <show-association name="qcp:mtApprover" display-label="Assigned MT signer" read-only="true"/>
</property-sheet>
</config>
(I left out irrelevant lines to reduce to the minimum needed).
During testing the workflow assigned the task to the mentioned person (Francois Buijs). And I was able to change the assigned person during the workflow with the expected effect.

pobe
Champ in-the-making
Champ in-the-making
Well in fact I succeeded in "predefining" a user and having the possibility to change it later on. I created an aspect holding the various users in the workflow and associated that aspect to all workflow types in the model description.
<types>
<type name="qcp:mtSignOff">
  <parent>bpm:workflowTask</parent>
  <mandatory-aspects>
   <aspect>qcp:assignments</aspect>
  </mandatory-aspects>
</type>
</types>

<aspects>
<aspect name="qcp:assignments">
  <associations>
   <association name="qcp:mtApprover">
    <source>
     <mandatory>false</mandatory>
     <many>false</many>
    </source>
    <target>
     <class>cm:person</class>
     <mandatory>false</mandatory>
     <many>false</many>
    </target>
   </association>
  </associations>
</aspect>
</aspects>
Inside the workflow I added the following script:
 <start-state name="initiateCcr">
  <task name="qcp:initiateCcr" swimlane="initiator">
   <event type="task-create">
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
     <script>
      <variable name="qcp_mtApprover" access="write"/>
      <expression>
       qcp_mtApprover = people.getPerson("Francois Buijs");
      </expression>
     </script>
    </action>
   </event>
  </task>
Although I added this to the <task-create> event of the start-state, the default will be visible in the next workflow step (provided the visibility is regulated in the "web-client-config-custom.xml" file as shown below:
<config evaluator="node-type" condition="qcp:mtSignOff" replace="true">
<property-sheet>
  <separator name="sep1" display-label="General" component-generator="HeaderSeparatorGenerator"/>
   <show-property name="bpm:taskId" read-only="true"/>
   <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
   <show-property name="bpm:dueDate" read-only="true"/>
   <show-property name="bpm:priority" read-only="true"/>
   <show-property name="bpm:status"/>
  <separator name="sep2" display-label="Required metadata" component-generator="HeaderSeparatorGenerator"/>
   <show-property name="qcp:wfPlannedArpRelease" display-label="Planned ARP release"/>
  <separator name="sep3" display-label="Roles and assigned users" component-generator="HeaderSeparatorGenerator"/>
   <show-association name="qcp:mtApprover" display-label="Assigned MT signer" read-only="true"/>
</property-sheet>
</config>
(I left out irrelevant lines to reduce to the minimum needed).
During testing the workflow assigned the task to the mentioned person (Francois Buijs). And I was able to change the assigned person during the workflow with the expected effect.

How did you change the assigned person?

/P

rob562435
Champ in-the-making
Champ in-the-making
When you open the task form there is the possibility to search for users for the specific role and then select a new user in stead of the "default" one. That's the part that the web-client-config-custom.xml file is regulating. Be aware that for every state you want to change the user you have to add a config part as shown!

pobe
Champ in-the-making
Champ in-the-making
Yes, i am able to use the UI to select a new user, but it doesnt seem to take effect in the workflow…
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.