cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the user of a workflow task

m_vriens
Champ in-the-making
Champ in-the-making
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?
1 REPLY 1

t_broyer
Champ in-the-making
Champ in-the-making
A transition is between nodes, and tasks are *within* nodes. When you're on a transition, the task is already completed and existed (technically, there can be more than one task in a same node in JBPM).

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

There's a "person" variable giving you the "current user" (and if it has a home space, you also have a "userhome" variable)
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.