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

Task Timer Reassignment by Scripted Assignment within Workflow is not working

    Details

      Description

      Current issue: Task Timer Reassignment by Scripted Assignment within Workflow is not working

      Steps to reproduce (based on PTR-1629):

      1) Create 2 users with screenName 12test and 13test.

      2) Import the workflow below, but change the following: 

      For the 3 entries that contain:

      import com.liferay.portal.kernel.service.UserLocalServiceUtil; user = UserLocalServiceUtil.getUserByScreenName(20096, "12test");

      Change "20096" to your own local portal companyID. You can check it by going to CP > Search > Field Mappings > liferay-<companyID>

      <?xml version="1.0"?>
      <workflow-definition
      	xmlns="urn:liferay.com:liferay-workflow_7.1.0"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:liferay.com:liferay-workflow_7.1.0 http://www.liferay.com/dtd/liferay-workflow-definition_7_1_0.xsd">
      	<name>Single Approver - test 1</name>
      	<description>A single approver can approve a workflow content test -1.</description>
      	<version>1</version>
      	<state>
      		<name>created</name>
      		<metadata>
      			<![CDATA[{"xy":[36,51]}]]>
      		</metadata>
      		<initial>true</initial>
      		<transitions>
      			<transition>
      				<name>review</name>
      				<target>review</target>
      				<default>true</default>
      			</transition>
      		</transitions>
      	</state>
      	<state>
      		<name>approved</name>
      		<metadata>
      			<![CDATA[{"xy":[380,51]}]]>
      		</metadata>
      		<actions>
      			<action>
      				<name>approve</name>
      				<script>
      					<![CDATA[import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowConstants;WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("approved"), workflowContext);]]>
      				</script>
      				<script-language>groovy</script-language>
      				<execution-type>onEntry</execution-type>
      			</action>
      		</actions>
      	</state>
      	<task>
      		<name>update</name>
      		<metadata>
      			<![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[328,199]}]]>
      		</metadata>
      		<actions>
      			<action>
      				<name>reject</name>
      				<script>
      					<![CDATA[import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowConstants;WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("denied"), workflowContext); WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("pending"), workflowContext);]]>
      				</script>
      				<script-language>groovy</script-language>
      				<execution-type>onAssignment</execution-type>
      			</action>
      			<notification>
      				<name>Creator Modification Notification</name>
      				<template>
      					<![CDATA[Your submission was rejected by ${userName}, please modify and resubmit.]]>
      				</template>
      				<template-language>freemarker</template-language>
      				<notification-type>email</notification-type>
      				<notification-type>user-notification</notification-type>
      				<recipients receptionType="to">
      					<user/>
      				</recipients>
      				<execution-type>onAssignment</execution-type>
      			</notification>
      		</actions>
      		<assignments>
      			<user/>
      		</assignments>
      		<transitions>
      			<transition>
      				<name>resubmit</name>
      				<target>review</target>
      				<default>true</default>
      			</transition>
      		</transitions>
      	</task>
      	<task>
      		<name>review</name>
      		<metadata>
      			<![CDATA[{"xy":[168,36]}]]>
      		</metadata>
      		<actions>
      			<notification>
      				<name>Review Notification</name>
      				<description>
      					<![CDATA[]]>
      				</description>
      				<template>
      					<![CDATA[${userName} sent you a ${entryType} for review in the workflow.]]>
      				</template>
      				<template-language>freemarker</template-language>
      				<notification-type>email</notification-type>
      				<notification-type>user-notification</notification-type>
      				<recipients receptionType="to">
      					<assignees/>
      				</recipients>
      				<execution-type>onAssignment</execution-type>
      			</notification>
      			<notification>
      				<name>Review Completion Notification</name>
      				<description>
      					<![CDATA[]]>
      				</description>
      				<template>
      					<![CDATA[Your submission was reviewed <#if taskComments?has_content> and the reviewer applied the following ${taskComments}</#if>.]]>
      				</template>
      				<template-language>freemarker</template-language>
      				<notification-type>email</notification-type>
      				<recipients receptionType="to">
      					<user/>
      				</recipients>
      				<execution-type>onExit</execution-type>
      			</notification>
      		</actions>
      		<assignments>
      			<scripted-assignment>
      				<script>
      					<![CDATA[ 
      					    import com.liferay.portal.kernel.service.UserLocalServiceUtil;
      					    user = UserLocalServiceUtil.getUserByScreenName(20096, "13test");
      					    roles = null;
      					 ]]>
      				</script>
      				<script-language>groovy</script-language>
      			</scripted-assignment>
      		</assignments>
      		<task-timers>
      			<task-timer>
      				<name>fdfds</name>
      				<description></description>
      				<delay>
      					<duration>1</duration>
      					<scale>minute</scale>
      				</delay>
      				<blocking>true</blocking>
      				<timer-actions>
      					<timer-notification>
      						<name>test</name>
      						<description>
      							<![CDATA[]]>
      						</description>
      						<template>
      							<![CDATA[test user notification]]>
      						</template>
      						<template-language>text</template-language>
      						<notification-type>email</notification-type>
      						<recipients receptionType="to">
      							<scripted-recipient>
      								<script>
                      					<![CDATA[ 
                      					    import com.liferay.portal.kernel.service.UserLocalServiceUtil;
                      					    user = UserLocalServiceUtil.getUserByScreenName(20096, "12test");
                      					    roles = null;
                      					 ]]>
      								</script>
      								<script-language>groovy</script-language>
      							</scripted-recipient>
      						</recipients>
      					</timer-notification>
      					<reassignments>
      						<scripted-assignment>
      							<script>
                      					<![CDATA[ 
                      					    import com.liferay.portal.kernel.service.UserLocalServiceUtil;
                      					    user = UserLocalServiceUtil.getUserByScreenName(20096, "12test");
                      					    roles = null;
                      					 ]]>
      							</script>
      							<script-language>groovy</script-language>
      						</scripted-assignment>
      					</reassignments>
      				</timer-actions>
      			</task-timer>
      		</task-timers>
      		<transitions>
      			<transition>
      				<name>approve</name>
      				<target>approved</target>
      				<default>true</default>
      			</transition>
      			<transition>
      				<name>reject</name>
      				<target>update</target>
      				<default>false</default>
      			</transition>
      		</transitions>
      	</task>
      </workflow-definition>
      

      3) Associate the workflow with blog entry.

      4) Create a new blog entry and wait 1 minute

      5) Impersonate 12test and check My Workflow Tasks

      Actual result: the task is not being reassigned to 12test after 1 minute

      Expected result: the task should be reassigned from 13test to 12test after 1 minute

      Environment:
      master DXP: b5845d9469aa1e2d914d1b78ae3eed6756a8e490

       

        Attachments

          Activity

            People

            Assignee:
            chao.wang Chao Wang
            Reporter:
            dennys.barros Dennys Barros (Inactive)
            Participants of an Issue:
            Recent user:
            Yunlin "Steven" Sun
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              45 weeks, 1 day ago

                Packages

                Version Package
                7.0.10.14 DXP SP14
                7.0.X
                7.1.10 DXP FP18
                7.1.10.5 SP5
                7.1.X
                7.2.X
                7.3.10 DXP GA1
                Master