Message Boards
How to assign User on kaleo workflow task
Montej Shah, modified 8 Years ago.
How to assign User on kaleo workflow task
Junior Member Posts: 48 Join Date: 2/18/15 Recent Posts
Hi i am working on kaleo workflow.
I have four task 'review content','underwrite content','offer price','approve or reject'
Now 'review content' assign to role 'A',
'underwrite content' assign to role 'B'
'offer price' assign to role 'C'
now i want assign 'approve or reject' to user who complete 'underwrite content' means user who has 'B' role or we can say who complete previous task.
Anyone can know how to do this?
I have also one question can i assign task to same user who currently process task ?
Any help will be appreciated
I have four task 'review content','underwrite content','offer price','approve or reject'
Now 'review content' assign to role 'A',
'underwrite content' assign to role 'B'
'offer price' assign to role 'C'
now i want assign 'approve or reject' to user who complete 'underwrite content' means user who has 'B' role or we can say who complete previous task.
Anyone can know how to do this?
I have also one question can i assign task to same user who currently process task ?
Any help will be appreciated
Bijan Vakili, modified 8 Years ago.
RE: How to assign User on kaleo workflow task
Expert Posts: 375 Join Date: 3/10/09 Recent Posts
There are many ways to achieve this task.
After bit of research, but not tested: you may use the WorkflowLog manager:
And iterate to find WorkflowLog field:
The way originally came to mind (without knowledge of workflow APIs):
One way is to record user's id; can be done via Expando table; and retrieved in "approve or reject" task. Of course many other ways to do it; though this is simplest I can think of.
I suggest using the former if can; since creating expando's redundant.
After bit of research, but not tested: you may use the WorkflowLog manager:
com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(...)
com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil.getWorkflowLogsByWorkflowTask(...)
And iterate to find WorkflowLog field:
workflowLog.getPreviousUserId()
The way originally came to mind (without knowledge of workflow APIs):
One way is to record user's id; can be done via Expando table; and retrieved in "approve or reject" task. Of course many other ways to do it; though this is simplest I can think of.
I suggest using the former if can; since creating expando's redundant.
Montej Shah, modified 8 Years ago.
RE: How to assign User on kaleo workflow task
Junior Member Posts: 48 Join Date: 2/18/15 Recent Posts
Hi ,
Thanks for your response.
As you told
com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(...) this method give List<WorkflowLog>.
From this List of WorkflowLog which is my required WorkflowLog so i can get PreviousUserId ?
Also this method require 'List<Integer> logTypes' as parameter what to pass here?
Thanks for your response.
As you told
com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(...) this method give List<WorkflowLog>.
From this List of WorkflowLog which is my required WorkflowLog so i can get PreviousUserId ?
Also this method require 'List<Integer> logTypes' as parameter what to pass here?
Bijan Vakili, modified 8 Years ago.
RE: How to assign User on kaleo workflow task
Expert Posts: 375 Join Date: 3/10/09 Recent Posts
Montej, you can look at source code for that; and try it out even using Console; if you're not sure about that follow up:
https://github.com/liferay/liferay-plugins/blob/master/webs/kaleo-web/docroot/WEB-INF/src/com/liferay/portal/workflow/kaleo/WorkflowLogManagerImpl.java#L64
See my post regarding Liferay Console:
https://www.liferay.com/en_GB/community/forums/-/message_boards/message/54781396?doAsUserId=ziifjfldhf%252F-%252Fmessage_boards%252Fview_message%252F7816800
https://github.com/liferay/liferay-plugins/blob/master/webs/kaleo-web/docroot/WEB-INF/src/com/liferay/portal/workflow/kaleo/WorkflowLogManagerImpl.java#L64
See my post regarding Liferay Console:
https://www.liferay.com/en_GB/community/forums/-/message_boards/message/54781396?doAsUserId=ziifjfldhf%252F-%252Fmessage_boards%252Fview_message%252F7816800