cancel
Showing results for 
Search instead for 
Did you mean: 

get username in workflow pooled

giorgio
Champ in-the-making
Champ in-the-making
Good, I'm changing a property of a document workflow, executing code from process_definition.xml, and in the case of workflows pooled for groups of type, I have no trouble getting the group name, but I think I need to when a user takes possession of the workflow to get the name of that user to modify the property, how we could do?

you get the code that I run to get the group name in review_pooled_processdefinition.xml


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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:reviewpooled">

<swimlane name="initiator" />

<start-state name="start">
<task name="wf:submitGroupReviewTask" swimlane="initiator" />
<transition name="" to="review" />
</ start-state>

<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors> # bpm_groupAssignee () </ pooledactors>
</ assignment>
</ swimlane>

<task-node name="review">
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate! = void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority! = void) taskInstance.priority = bpm_workflowPriority;
</ script>
</ event>
<event type="task-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_assignee" access="write"/>
<expression>
if (taskInstance.actorId! = null)
people.getPerson (taskInstance.actorId);
else
person;
</ expression>
</ script>
</ action>
</ event>
</ task>
<transition name="" to="completed" />
<event type="node-enter">
<! - Update the status to Rejected when we enter this task ->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i <bpm_package.children.length i + +)
(

bpm_package.children . properties [ "my: priority"] = bpm_workflowPriority;
bpm_package.children . properties [ "my: state"] = "Pending";
/ / get the line with this group, but in that time you could get?
bpm_package.children . properties [ "my: tecnico"] = bpm_groupAssignee.properties [ "usr: authorityName"];
bpm_package.children . save ();
)
</ script>
</ action>
</ event>
</ task-node>



<task-node name="completed">
<event type="node-enter">
<! - Update the status to take advantage when we enter this task ->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var a = 0; a <bpm_package.children.length, a + +)
(
bpm_package.children [a]. properties [ "my: priority"] = bpm_workflowPriority;
bpm_package.children [a]. properties [ "my: state"] = "Finish";
bpm_package.children [a]. properties [ "my: tecnico"] = bpm_groupAssignee.properties [ "usr: authorityName"];
bpm_package.children [a]. save ();
)
</ script>
</ action>
</ event>
<transition name="" to="end" />
</ task-node>

<end-state name="end" />

</ process-definition>



I hope someone can help me.

Greetings and thanks in advance
2 REPLIES 2

cheffilet
Champ in-the-making
Champ in-the-making
If the user takes the ownership of an task you should receive the appropriated username on accessing the TaskInstance.ActorId property. You can get this value via ContentModel.PROP_OWNER on properties attribute regarding a WorkflowTask. If you want informed about an assignment you should add an AssignmentHandler to the appropriated task.

Best Regards

giorgio
Champ in-the-making
Champ in-the-making
I've been looking bpmModel.xml file which defines the properties of workflows but the property is ownable model is contentModel.xml cm: ownable, and is an aspect, if I go to the definition of this I find this:

//this is the aspect on bpmModel.xml
    <mandatory-aspects>
                <aspect>cmSmiley Surprisedwnable</aspect>
            </mandatory-aspects>

and this is on the contentModel.xml
      <aspect name="cmSmiley Surprisedwnable">
         <title>Ownable</title>
         <properties>
            <property name="cmSmiley Surprisedwner">
               <title>Owner</title>
               <type>d:text</type>
            </property>
         </properties>
      </aspect>

in so that in the processdefinition.xml not like would have to gain access, if bpm_ownable or cm_owner, I have tried several and did not get, I try workflow.owner … i ' dont know who is de good. Sorry for my english.

Greatings and thanks.
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.