cancel
Showing results for 
Search instead for 
Did you mean: 

Check IN document in workflow

ph73nt
Champ in-the-making
Champ in-the-making
dear list,

I'm having trouble checking in a document during a workflow. I have succeeded in checking out a document with a different workflow, but in my new "activate" workflow I can't check it in. There are no errors thrown but the document remains checked out. Here's the important bit of my workflow (from the completed step):


   <task-node name="publish">
      <transition to="end" name=""></transition>
      <task name="nm:completedTask" swimlane="initiator">
         <event type="node-enter">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <runas>admin</runas>
               <script>
                  for (var i = 0; i &lt; bpm_package.children.length; i++){
                     bpm_package.children[i].checkin();
                  }    
               </script>
            </action>
         </event>
      </task>
   </task-node>

I would prefer to assign the document to a variable, but haven't managed this with either the content or noderef types described in the API. Is this possible? Is bpm_package available method-wide?

I'd be grateful for some (more) help. Thanks in advance,

Neil
1 REPLY 1

ph73nt
Champ in-the-making
Champ in-the-making
This worked when I made the <task-node> a <node> and removed the <task>. Working code:

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.2"
   name="Activate Draft">

   <start-state name="start">
      <task name="nm:start" swimlane="initiator" />
      <transition to="activate"></transition>
   </start-state>

   <node name="activate">
      <transition to="end" name="activate"></transition>
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <runas>admin</runas>            
            <script>               
               var i = bpm_package.children.length;
               var path = companyhome.childByNamePath("Drafts");
               for (var i = 0; i &lt; bpm_package.children.length; i++){
                  bpm_package.children[i].checkin("History", false);   
               }                 
            </script>
         </action>
      </event>
   </node>

   <end-state name="end"></end-state>
   <swimlane name="initiator"></swimlane>


</process-definition>

Hope this helps some other noob sometime. Neil