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

CDATA blocks in an embedded FreeMarker template of a workflow definition are not formatted correctly on CE version only

    Details

      Description

      Steps to Reproduce

      1a. On master, navigate to Global Menu (3x3 grid icon on top-right of page) > Process Builder
      1b. On branch, navigate to Control Panel > Configuration > Workflow
      2. Create a new workflow
      3. Paste the following as the workflow definition and save:

      <?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 PWS-928 FreeMarker Template Indent Test</name>
      	<description>A single approver can approve a workflow content.</description>
      	<version>1</version>
      	<state>
      		<name>created</name>
      		<metadata><![CDATA[{"xy":[36,51],"transitions":{"review":{"bendpoints":[]}}}]]></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[
      						<#-- PWS-928 Sample FreeMarker Comment -->
      
      						<#assign contentItemSubject = "Your document was rejected by ${userName}, please modify and resubmit.">
      
      						<#macro workflowCreatorModificationNotificationSubject prefix entryClassPK entryClassName>
      							${prefix}
      							
      							<#if entryClassPK?has_content && entryClassName?has_content && entryClassName == "com.liferay.journal.model.JournalArticle">
      								<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
      								<#assign article = journalArticleLocalService.getArticle(entryClassPK?number)!"">
      								<#if article?has_content>
      									<#assign contentItemSubject = "Your article was rejected by ${userName}, please modify and resubmit.">
      								</#if>
      							</#if>
      
      							<#if entryClassPK?has_content && entryClassName?has_content && entryClassName == "com.liferay.document.library.kernel.model.DLFileEntry">
      								<#assign dlAppService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppService")>
      								<#assign fileEntry = dlAppService.getFileEntry(entryClassPK?number)!"">
      								<#if fileEntry?has_content>
      									<#assign contentItemSubject = "Your document was rejected by ${userName}, please modify and resubmit.">
      								</#if>
      							</#if>
      							
      							<#if contentItemSubject?has_content>
      								- ${contentItemSubject}
      							</#if>
      						</#macro>
      						
      						<@workflowCreatorModificationNotificationSubject contentItemSubject entryClassPK entryClassName />
      					]]>
      				</template>
      				<template-language>freemarker</template-language>
      				<notification-type>email</notification-type>
      				<notification-type>user-notification</notification-type>
      				<recipients>
      					<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],"transitions":{"reject":{"bendpoints":[]}}}]]></metadata>
      		<actions>
      			<notification>
      				<name>Review Notification</name>
      				<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>
      					<user/>
      				</recipients>
      				<execution-type>onAssignment</execution-type>
      			</notification>
      			<notification>
      				<name>Review Completion Notification</name>
      				<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>
      			<roles>
      				<role>
      					<role-type>organization</role-type>
      					<name>Organization Administrator</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>organization</role-type>
      					<name>Organization Content Reviewer</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>organization</role-type>
      					<name>Organization Owner</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>regular</role-type>
      					<name>Administrator</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>regular</role-type>
      					<name>Portal Content Reviewer</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>site</role-type>
      					<name>Site Administrator</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>site</role-type>
      					<name>Site Content Reviewer</name>
      					<auto-create>false</auto-create>
      				</role>
      				<role>
      					<role-type>site</role-type>
      					<name>Site Owner</name>
      					<auto-create>false</auto-create>
      				</role>
      			</roles>
      		</assignments>
      		<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>
      

      Expected Results
      The new workflow is formatted correctly

      Actual Results
      The workflow is formatted incorrectly

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              melody.wu Melody Wu
              Reporter:
              jesse.yeh Jesse Yeh
              Participants of an Issue:
              Recent user:
              Yunlin "Steven" Sun
              Engineering Assignee:
              Jesse Yeh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 6 days ago

                  Packages

                  Version Package
                  7.1.10 DXP FP19
                  7.1.10.5 SP5
                  7.1.X
                  7.2.10 DXP FP7
                  7.2.X
                  7.3.3 CE GA4
                  7.3.10 DXP GA1
                  Master