留言板

how to get the assignee userid inside a workflow task?

thumbnail
Stefano Pullini,修改在8 年前。

how to get the assignee userid inside a workflow task?

New Member 帖子: 3 加入日期: 10-11-10 最近的帖子
Good Day.

Inside a Kaleo workflow definition file, I need to develope a script to get the userId of the user who got assigned the current task. Then I will manage to save that userid for later use (I use a messaging tool to store variables across different tasks, so that I can store a value in task1 and retrieve it in task2). In this way I will be able to get back to that single user, instead of the role. I noticed that there is a database table named KALEOTASKASSIGNMENTINSTANCE that probably stores the information I need.

This is the table definition.

CREATE MEMORY TABLE PUBLIC.KALEOTASKASSIGNMENTINSTANCE(KALEOTASKASSIGNMENTINSTANCEID BIGINT NOT NULL PRIMARY KEY,GROUPID BIGINT,COMPANYID BIGINT,USERID BIGINT,USERNAME VARCHAR(200),CREATEDATE TIMESTAMP,MODIFIEDDATE TIMESTAMP,KALEODEFINITIONID BIGINT,KALEOINSTANCEID BIGINT,KALEOINSTANCETOKENID BIGINT,KALEOTASKINSTANCETOKENID BIGINT,KALEOTASKID BIGINT,KALEOTASKNAME VARCHAR(200),ASSIGNEECLASSNAME VARCHAR(200),ASSIGNEECLASSPK BIGINT,COMPLETED BIT(1),COMPLETIONDATE TIMESTAMP)

And this is the insert operation resulting from Peter assigning to himself the "review" task in the single approver example.

INSERT INTO KALEOTASKASSIGNMENTINSTANCE VALUES(21130,20182,20155,20771,'Peter','2015-05-08 09:28:09.694000','2015-05-08 09:28:09.694000',21035,21116,0,21123,21046,'review','com.liferay.portal.model.User',20771,'1','2015-05-08 09:28:13.687000')

In the above example the user 'Peter' has userid=20771 and has just carried out the "review" task. In this example there are 2 users:

- test, userid=20199
- Peter, userid=20771

The workflow example is the single-approver-definition.xml, as I write before. The user "test" starts the workflow by creating a DDL record. Then "Peter" approves that record by the "review" task. Inside "review" I need to include a groovy script "onExit" to determine which user carried out that task.

In thew context variables it seems there is only 20199, that is "test", the workflow instance creator.

Is there any of you who had to face this issue in the past and can write me down some sample lines of groovy script, so that I can get a start? I am not a developer, but I can handle groovy scripts.

Thank you

Stefano
Padmanabha T,修改在7 年前。

RE: how to get the assignee userid inside a workflow task?

Junior Member 帖子: 27 加入日期: 14-8-31 最近的帖子
Hi stefano ,

Did you get the solution for it ?