Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Enrico Maria Rossi
Kaleo workflow assign-to a list of users
February 12, 2013 6:39 AM
Answer

Enrico Maria Rossi

Rank: New Member

Posts: 22

Join Date: January 15, 2013

Recent Posts

Hi,
with Kaleo Workflow is it possible in My Worflow Tsks page assign-to a list of users?, I see, i can assign-to only one user. Thanks.

Regards,

Enrico
Attachment

Attachments: new_screenshot.jpg (174.2k)
Gnaniyar Zubair
RE: Kaleo workflow assign-to a list of users
February 12, 2013 6:46 AM
Answer

Gnaniyar Zubair

Rank: Liferay Master

Posts: 603

Join Date: December 19, 2007

Recent Posts

You need to tweak the workflow definition file to assign the task to specific roles.

then you can map set of users into that roles. So, Tasks will be assigned to all the users mapped with specif role

HTH
Enrico Maria Rossi
RE: Kaleo workflow assign-to a list of users
February 12, 2013 7:21 AM
Answer

Enrico Maria Rossi

Rank: New Member

Posts: 22

Join Date: January 15, 2013

Recent Posts

Hi Gnaniyar Zubair,
thanks, but I did it. I attached my xml file.
My case is Sequential according to roles. 3 step to publish a WebContent.
Only the role "Redattore KBMS Super" can reject or assign to a list (2-3-4) of users or publish a WecContent in every moment (my expected goal).
The role "Redattore KBMS Basic" can assign a task to a list (2-3-4) of users and can approve for next step or reject, but he can't publish a WebContent (my expected goal).
In the select that appear on My Workflow Tasks (newscreenshot) page how can I assign a task to a 2-3-4 of users. I see that I can select only one user from extinsting users. From xml i don't manage it. Can you help me? Thanks and sorry if I' didn't explaine well my problem.
Attachments: multiplo_custom_v1_fase2.xml (20.3k)
Enrico Maria Rossi
RE: Kaleo workflow assign-to a list of users
February 13, 2013 8:14 AM
Answer

Enrico Maria Rossi

Rank: New Member

Posts: 22

Join Date: January 15, 2013

Recent Posts

I have to modify the Workflow classes's methods, because in these classes there are methods only for assign a task to one user (expected List<User>). Example:

* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.portal.kernel.workflow;

import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
import com.liferay.portal.kernel.util.OrderByComparator;

import java.io.Serializable;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author Micha Kiener
* @author Shuyang Zhou
* @author Brian Wing Shun Chan
* @author Marcellus Tavares
* @author Raymond Augé
*/


public class WorkflowTaskManagerUtil {

public static WorkflowTask assignWorkflowTaskToRole(
long companyId, long userId, long workflowTaskId, long roleId,
String comment, Date dueDate,
Map<String, Serializable> workflowContext)
throws WorkflowException {

return getWorkflowTaskManager().assignWorkflowTaskToRole(
companyId, userId, workflowTaskId, roleId, comment, dueDate,
workflowContext);
}

public static WorkflowTask assignWorkflowTaskToUser(
long companyId, long userId, long workflowTaskId,
long assigneeUserId, String comment, Date dueDate,
Map<String, Serializable> workflowContext)
throws WorkflowException {

return getWorkflowTaskManager().assignWorkflowTaskToUser(
companyId, userId, workflowTaskId, assigneeUserId, comment, dueDate,
workflowContext);
}




public static WorkflowTask completeWorkflowTask(
long companyId, long userId, long workflowTaskId,
String transitionName, String comment,
Map<String, Serializable> workflowContext)
throws WorkflowException {

return getWorkflowTaskManager().completeWorkflowTask(
companyId, userId, workflowTaskId, transitionName, comment,
workflowContext);
}


......
......
.....
......
......
......
......

public void setWorkflowTaskManager(
WorkflowTaskManager workflowTaskManager) {

PortalRuntimePermission.checkSetBeanProperty(getClass());

_workflowTaskManager = workflowTaskManager;
}

private static WorkflowTaskManager _workflowTaskManager;

}








If you see workflow_task_action.jsp below, you see that you can assign a task to only one user:





<%--
/**
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>

<%@ include file="/html/portlet/workflow_tasks/init.jsp" %>

<%
String randomId = StringPool.BLANK;

String closeRedirect = ParamUtil.getString(request, "closeRedirect");

ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);

WorkflowTask workflowTask = null;

if (row != null) {
randomId = PwdGenerator.getPassword(PwdGenerator.KEY3, 4);

Object result = row.getObject();

workflowTask = (WorkflowTask)row.getParameter("workflowTask");
}
else {
workflowTask = (WorkflowTask)request.getAttribute(WebKeys.WORKFLOW_TASK);
}

long[] pooledActorsIds = WorkflowTaskManagerUtil.getPooledActorsIds(company.getCompanyId(), workflowTask.getWorkflowTaskId());
%>

<liferay-ui:icon-menu showExpanded="<%= (row == null) %>" showWhenSingleIcon="<%= (row == null) %>">
<c:if test="<%= !workflowTask.isCompleted() && _isAssignedToUser(workflowTask, user) %>">

<%
List<String> transitionNames = WorkflowTaskManagerUtil.getNextTransitionNames(company.getCompanyId(), user.getUserId(), workflowTask.getWorkflowTaskId());

for (String transitionName : transitionNames) {
String message = "proceed";

if (Validator.isNotNull(transitionName)) {
message = transitionName;
}
%>

<portlet:actionURL var="editURL">
<portlet:param name="struts_action" value="/workflow_tasks/edit_workflow_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.SAVE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="closeRedirect" value="<%= closeRedirect %>" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= StringUtil.valueOf(workflowTask.getAssigneeUserId()) %>" />

<c:if test="<%= transitionName != null %>">
<portlet:param name="transitionName" value="<%= transitionName %>" />
</c:if>
</portlet:actionURL>

<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-change-status-link" %>'
id='<%= randomId + transitionName + "taskChangeStatusLink" %>'
image="../aui/shuffle"
message="<%= message %>"
method="get"
url="<%= editURL %>"
/>

<%
}
%>

</c:if>

<c:if test="<%= !workflowTask.isCompleted() && !_isAssignedToUser(workflowTask, user) %>">
<portlet:actionURL var="assignToMeURL">
<portlet:param name="struts_action" value="/workflow_tasks/edit_workflow_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ASSIGN %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="closeRedirect" value="<%= closeRedirect %>" />
<portlet:param name="workflowTaskId" value="<%= String.valueOf(workflowTask.getWorkflowTaskId()) %>" />
<portlet:param name="assigneeUserId" value="<%= String.valueOf(user.getUserId()) %>" />
</portlet:actionURL>

<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-assign-to-me-link" %>'
id='<%= randomId + "taskAssignToMeLink" %>'
image="assign"
message="assign-to-me"
method="get"
url="<%= assignToMeURL %>"
/>
</c:if>

<c:if test="<%= _hasOtherAssignees(pooledActorsIds, workflowTask, user) %>">
<portlet:actionURL var="assignURL">
<portlet:param name="struts_action" value="/workflow_tasks/edit_workflow_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ASSIGN %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="closeRedirect" value="<%= closeRedirect %>" />
<portlet:param name="workflowTaskId" value="<%= String.valueOf(workflowTask.getWorkflowTaskId()) %>" />
</portlet:actionURL>

<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-assign-link" %>'
id='<%= randomId + "taskAssignLink" %>'
image="assign"
message="assign-to-..."
method="get"
url="<%= assignURL %>"
/>
</c:if>

<c:if test="<%= !workflowTask.isCompleted() %>">
<portlet:actionURL var="updateDueDateURL">
<portlet:param name="struts_action" value="/workflow_tasks/edit_workflow_task" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.UPDATE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="workflowTaskId" value="<%= StringUtil.valueOf(workflowTask.getWorkflowTaskId()) %>" />
</portlet:actionURL>

<liferay-ui:icon
cssClass='<%= "workflow-task-" + randomId + " task-due-date-link" %>'
id='<%= randomId + "taskDueDateLink" %>'
image="time"
message="update-due-date"
method="get"
url="<%= updateDueDateURL %>"
/>
</c:if>
</liferay-ui:icon-menu>

<div class="aui-helper-hidden" id="<%= randomId %>updateAsignee">
<c:if test="<%= _hasOtherAssignees(pooledActorsIds, workflowTask, user) %>">
<aui:select label="assign-to" name="assigneeUserId">

<%
for (long pooledActorId : pooledActorsIds) {
if (pooledActorId == user.getUserId()) {
continue;
}
%>

<aui:option label="<%= HtmlUtil.escape(PortalUtil.getUserName(pooledActorId, StringPool.BLANK)) %>" selected="<%= workflowTask.getAssigneeUserId() == pooledActorId %>" value="<%= String.valueOf(pooledActorId) %>" />

<%
}
%>

</aui:select>
</c:if>
</div>


<div class="aui-helper-hidden" id="<%= randomId %>updateAsigneeToMe">
<aui:input name="asigneeUserId" type="hidden" value="<%= user.getUserId() %>" />
</div>

<div class="aui-helper-hidden" id="<%= randomId %>updateDueDate">
<aui:input bean="<%= workflowTask %>" model="<%= WorkflowTask.class %>" name="dueDate" />
</div>

<div class="aui-helper-hidden" id="<%= randomId %>updateComments">
<aui:input cols="55" name="comment" rows="10" type="textarea" />
</div>

<aui:script use="liferay-workflow-tasks">
var onTaskClickFn = A.rbind(Liferay.WorkflowTasks.onTaskClick, Liferay.WorkflowTasks, '<%= randomId %>');

<c:if test="<%= !workflowTask.isCompleted() && _isAssignedToUser(workflowTask, user) %>">

<%
List<String> transitionNames = WorkflowTaskManagerUtil.getNextTransitionNames(company.getCompanyId(), user.getUserId(), workflowTask.getWorkflowTaskId());

for (String transitionName : transitionNames) {
String message = "proceed";

if (Validator.isNotNull(transitionName)) {
message = transitionName;
}
%>

Liferay.delegateClick('<portlet:namespace /><%= randomId + transitionName %>taskChangeStatusLink', onTaskClickFn);

<%
}
%>

</c:if>

Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskAssignToMeLink', onTaskClickFn);
Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskAssignLink', onTaskClickFn);
Liferay.delegateClick('<portlet:namespace /><%= randomId %>taskDueDateLink', onTaskClickFn);
</aui:script>





Solution????
Gauri Bansode
RE: Kaleo workflow assign-to a list of users
November 29, 2013 5:22 AM
Answer

Gauri Bansode

Rank: Junior Member

Posts: 44

Join Date: May 4, 2011

Recent Posts

Hi Enrico Maria Rossi,

Have you got the solution? I need same requirement, In My Workflow Task portlet instead of only one user (in Drop Down box) I want to assign a workflow task to some List of users having Same Role and then make the task Approved if at least 2 users of them approve that task. It would be great if you share your solution here.
Thanks in advance.

Regards,
Gauri