cancel
Showing results for 
Search instead for 
Did you mean: 

variables

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
hi problem is this:
I have task where user must upload document,
is there a way to set this up? if there is please say how because I have not fount id.

————
because I have not found solution this was the idea:
task A remember number of uploaded documents
decision : if(bpm_childeren.size()>count) next task else task A.

but problem is in variables.

<task-node name="ZahtevZaKreiranjeUpitnika">
      <task name="od:ZahtevZaKreiranjeUpitnika" swimlane="salessupport" />

      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
                                     <variable name="bpm_package" access="read" />
               <expression>
               od_tempCnt= bpm_package.children.length;
                            </expression> 
             <variable name="od_tempCnt" access="write" />
            </script>
         </action>
            </event>
.
.
.
</task-node>


   <decision name="decision1">
      <transition to="ProveraKvalitetaUpitnika">
         <condition>#{bpm_package.children.length>=od_tempCnt}</condition> IN HERE VARIABLE IN UNDEFINED OR NULL
      </transition>
      <transition to="Uploaduj upitnik" name="Fali dokument">
      </transition>
   </decision>


PLEASE HELP :!:
7 REPLIES 7

gravitonian
Star Collaborator
Star Collaborator
Try using Alfresco Javascript instead:

<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
   <script>
      <variable name="od_tempCnt" access="write"/>
     <expression>
          od_tempCnt = bpm_package.children.length;
      </expression>
      </script>
</action>

  <decision name="decision1">
        <description>
            Note. I found often that the default transition "no" has to be first in this decision node otherwise the condition will
            always evaluate to true.
        </description>
        <transition to="ProveraKvalitetaUpitnika" name="ok"></transition>
        <transition to="Uploaduj upitnik" name="missingdoc">
            <condition>#{bpm_package.children.length<=od_tempCnt}</condition>
        </transition>
    </decision>

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
<task-node name="ZahtevZaKreiranjeUpitnika">
      <task name="od:ZahtevZaKreiranjeUpitnika" swimlane="salessupport" />

      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               <variable name="bpm_package" access="read" />
               <expression>
               od_timecapsule= bpm_package.children.length;
               logger.log("Hello ! START upladovano jeu prethodnom koraku    ["+od_timecapsule+ "] dok je sada "+bpm_package.children.length );
               executionContext.setVariable("od_timecapsule", od_timecapsule);
             </expression> 
             <variable name="od_timecapsule" access="write" />
            </script>
         </action>
      </event>
      
      <transition to="decision1" name="DaLiJeUpitnikDovoljnoKvalitetan">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
                <variable name="person" access="read" />
               <expression>
                  logger.log("Hello ! ZahtevZaKreiranjeUpitnika ");
                  person_time=person;
                  logger.log("Hello ! ZahtevZaKreiranjeUpitnika ");
                  </expression>
                  <variable name="person_time" access="write" />
            </script>
         </action>
               </transition>
   </task-node>


   <decision name="decision1">
      <transition to="ProveraKvalitetaUpitnika">
         <condition>#{bpm_package.children.length>=od_timecapsule}</condition> NULL POINTER IS HERE  :twisted:
      </transition>
      <transition to="Uploaduj upitnik" name="Fali dokument">
      </transition>
   </decision>

sorry for the serbian language

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
please evalutate the code,
I am looking and looking but I can not find the error.

gravitonian
Star Collaborator
Star Collaborator
Sorry, my fault the decision node is not a task node.

You have to setup another variable when users leave the task (where they must add doc) that contains the new count and then use in decision:

<variable name="bpm_package" access="read" />
               <expression>
               new_timecapsule= bpm_package.children.length;
             </expression> 


<decision name="decision1">
      <transition to="ProveraKvalitetaUpitnika">
         <condition>#{new_timecapsule>=od_timecapsule}</condition>
      </transition>
      <transition to="Uploaduj upitnik" name="Fali dokument">
      </transition>
   </decision>

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
soloved.

hyperation
Champ on-the-rise
Champ on-the-rise
Hi,

Can you post the solution to the problem?

Is it to create a node-end task and setting the variable there?

Thanks
Smiley Happy

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
well, it is soloved, but dropped because this lead to thousands lines of code, so not very good solution my friend. let me tell you in advance.
And it was not working when you split workflow on N distinct users. So just drop it , or make changes to the workflow bean who renders workflow actions and limit there upload with some settings .