Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-31981

Allow a user to assign a task to another user, in case of a workflow assignment by a groovy script



      Steps to reproduce:

      1. Create a site Kaleo
      2. Create a user reviewer1
      3. Assign user reviewer1
      4. Assign role Portal Content Reviewer to user reviewer1
      5. Create a user reviewer2
      6. Assign user reviewer2
      7. Assign role Portal Content Reviewer to user reviewer2
      8. Go to Control Panel > Configuration > Workflow Definition and upload definition workflowScript.xml with name "By script"
      9. Go to site Kaleo > Configuration > Workflow Configuration and set Workflow assignment-by-script to resource "Blogs Entry"
      10. Create a new Blog Entry
      11. Login as user reviewer 1
      12. Go to My Account > My Workflows Tasks

      Actual result:
      The available actions for the pending task are "Assign to me" and "Update Due Date"

      Expected result:
      The available actions for the pending task are "Assign to me", "Assign to ..." and "Update Due Date"

      To assign a task to another user is currently possible if the assignment is defined in the workflow definition's xml file.

      Example of the single-approver-definition.xml (from Kaleo):

      <name>Organization Owner</name>
      <name>Portal Content Reviewer</name>
      <name>Site Owner</name>

      If the task assignment is rewritten to process a user data input:

      <script><![CDATA[// Script d'assignement du mail lors de l'assignement de la tâche.
      import com.liferay.portal.kernel.util.GetterUtil;
      import com.liferay.portal.kernel.workflow.WorkflowConstants;
      import com.liferay.portal.model.Role;
      import com.liferay.portal.service.RoleLocalServiceUtil;
      import com.liferay.portal.service.ServiceContext;
      import com.liferay.portlet.journal.model.JournalArticle;
      import com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil;
      import com.liferay.portal.service.UserLocalServiceUtil;
      import com.choregie.util.GescoUtils;
      roles = new ArrayList<Role>();
      // Récupération du l'article en cours afin de récupérer le référent
      ServiceContext serviceContext = workflowContext.get(WorkflowConstants.CONTEXT_SERVICE_CONTEXT);
      String classPKJournalArticle = serviceContext.getAttribute("classPK");
      String referent = GescoUtils.getAssetReferent(serviceContext.getAttribute("className"),
      GetterUtil.getLong((String) classPKJournalArticle));
      if (referent != null && referent != "-1") {
      Role roleReferent = RoleLocalServiceUtil.getRole(Long.parseLong(referent));
      } else {
      long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
      Role roleResponsableSite = RoleLocalServiceUtil.getRole(companyId, "Responsable de Site");
      user = null;]]>

      In the portlet « my_tasks » , there is no possibility to assign the task to another user.
      In the jsp file « workflow_task_action.jsp », the method getPooledActorsIds returns assignable users of a workflow task:

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

      The method getPooledActorsIds (in com.liferay.portal.workflow.kaleo.WorkflowTaskManagerImpl) lists the assignment for the current task, only for the role type.

      List<KaleoTaskAssignment> kaleoTaskAssignments = KaleoTaskAssignmentLocalServiceUtil.getKaleoTaskAssignments(kaleoTask.getKaleoTaskId(), Role.class.getName());

      This method should list all the assignment types and (in case of assignment using a script) it should execute the groovy script to return the assignable users.




            mark.jin Mark Jin (Inactive)
            patricia.draut Patricia Draut
            Participants of an Issue:
            Recent user:
            Michael Wine
            2 Vote for this issue
            3 Start watching this issue


              Days since last comment:
              7 years, 6 weeks ago


                Version Package
                7.0.0 M7