cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow and Document

thomasberment
Champ in-the-making
Champ in-the-making
Hi, I search how it's possible to modify my own document's properties in my workflow.

I think it's a script like :
<task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                <script>
               document.properties['custom:statutdocument'] = 'En relecture';
               document.save;
          </script>
            </event>
        </task>
        <transition name="approve" to="approved" />
        <transition name="reject" to="rejected" />
    </task-node>

But it doesn't work ! I read the wiki and I find anything …
12 REPLIES 12

thomasberment
Champ in-the-making
Champ in-the-making
Can you explain me, how put a condition in my start-state ?

I find anything for cancelled my workflow …
<start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator"/>
         <transition name="inReview" to="node1">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="bpm_package" access="read" />
                  <expression>
                       if(bpm_package.children[0].properties["custom:statutdocument"] != "Travail")
                       {
                          ?END?
                       }
                       else
                       {
                        bpm_package.children[0].properties["custom:statutdocument"] = "En relecture";
                        bpm_package.children[0].save();
                     }
                  </expression>
               </script>
            </action>
         </transition>
    </start-state>

thomasberment
Champ in-the-making
Champ in-the-making
Hi, to do a condition to run my workflow, I have this code :

<exception-handler>
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            <variable name="bpm_package" access="read" />
                <expression>
                   bpm_package.children[0].properties["custom:statutdocument"] != "Travail";
                </expression>
            </script>
      </action>      
   </exception-handler>

But, it dosen't work …
Have you an idea or a tutorial for me ?
Thx.

thomasberment
Champ in-the-making
Champ in-the-making
I changed my code for this :

<start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator"/>
         <transition name="inReview" to="condition">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <variable name="bpm_package" access="read" />
                  <variable name="statutDoc" access="read,write" />
                      <expression>
                         statutDoc = bpm_package.children[0].properties["custom:statutdocument"];

                      </expression>
                  </script>
            </action>
         </transition>
    </start-state>
   
    <decision name="condition">
      <transition name="conditionOK" to="sendMail">
         <condition>
            #{statutDoc == "Travail"}
         </condition>
      </transition>
      <transition name="conditionKO"  to="end">
         <condition>
            #{statutDoc != "Travail"}
         </condition>
      </transition>
   </decision>

And it works !