AnsweredAssumed Answered

Getting the user of a workflow task

Question asked by m.vriens on Jan 6, 2009
Latest reply on Jan 6, 2009 by t.broyer
Hi all,

I am trying to get at the username of the user executing an action in a advanced workflow. I want to add the name of the user adding the comment in workflow where stakeholders can give their comments. This should be simple right? Well..

After a lot of messing about with Javascript, I gave up on that and decided to try my luck implementing an action in Java. But still no luck. I am a bit out of ideas right now.

This is the obvious solution, but that doesn't work.


<task-node name="stakeHolderReview">
   <task name="odmswf:stakeHolderReview">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{stakeholder}</actor>
      </assignment>
        <transition name="Approve" to="endStakeholderReview">
        <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
             <script>
                <variable name="odmswf_stakeholderComments" access="read,write" />
                <variable name="odmswf_stakeholderName" access="read" />
                <variable name="odmswf_comment" access="read,write" />
                <variable name="bpm_outcome" access="read" />
                <expression><![CDATA[
                   odmswf_stakeholderComments += taskInstance.actorId+" : " +bpm_outcome+ " : " +odmswf_comment+ "\n\n";
                   odmswf_comment = "";
                 ]]>
               </expression>
             </script>
        </action>   
        </transition>
</task-node>

Which gets me a nice:

Caused by: org.alfresco.error.AlfrescoRuntimeException: ReferenceError: "taskInstance" is not defined. (AlfrescoScript#1)

Anybody know how to get at the name of the user executing a transition or task?

Outcomes