1

My use case is pretty straight forward for using single approver workflow for Web Contents.

  1. User create web-content
  2. It Goes for review
  3. If Reviewer approved it got display
  4. If Reviewer reject, it should view as denied and user should able to re-submit it again for review

I'm having issue at point 4.

When reviewer rejects, it goes as denied. But when the created tries to re-edit the web content and "submit for publication" it always stays in "Draft" mode. Reviewer did not get any task in their workflow task.

I'm using liferay 6.2 ce ga 3. Following is my workflow definition.

<?xml version="1.0"?>

<workflow-definition
    xmlns="urn:liferay.com:liferay-workflow_6.2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0.xsd"
>
    <name>Single Approver</name>
    <description>A single approver can approve a workflow content.</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>
            </transition>
        </transitions>
    </state>
    <task>
        <name>update</name>
        <metadata>
            <![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[328,199]}]]>
        </metadata>
        <actions>
            <action>
                <name>reject</name>
                <script>
                    <![CDATA[
                        Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
                    ]]>
                </script>
                <script-language>javascript</script-language>
                <execution-type>onAssignment</execution-type>
            </action>
            <notification>
                <name>Creator Modification Notification</name>
                <template>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>
                <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>
                <template>${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>
                <execution-type>onAssignment</execution-type>
            </notification>
            <notification>
                <name>Review Completion Notification</name>
                <template>
                    Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</template>
                <template-language>freemarker</template-language>
                <notification-type>email</notification-type>
                <recipients>
                    <user />
                </recipients>
                <execution-type>onExit</execution-type>
            </notification>
        </actions>
        <assignments>
            <roles>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Administrator</name>
                </role>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Content Reviewer</name>
                </role>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Owner</name>
                </role>
                <role>
                    <role-type>regular</role-type>
                    <name>Administrator</name>
                </role>
                <role>
                    <role-type>regular</role-type>
                    <name>Portal Content Reviewer</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Administrator</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Content Reviewer</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Owner</name>
                </role>
            </roles>
        </assignments>
        <transitions>
            <transition>
                <name>approve</name>
                <target>approved</target>
            </transition>
            <transition>
                <name>reject</name>
                <target>update</target>
                <default>false</default>
            </transition>
        </transitions>
    </task>
    <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.toStatus("approved"), workflowContext);
                    ]]>
                </script>
                <script-language>groovy</script-language>
                <execution-type>onEntry</execution-type>
            </action>
        </actions>
    </state>
</workflow-definition>

Do I need to add any other state or action for achieving point 4?

aston
  • 632
  • 5
  • 17

2 Answers2

0

Without looking at your XML (I am answering this on my phone), the description sounds just like the automatically installed single approver workflow. You can download and inspect this workflow's XML and compare it to your current one.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • The one which comes OOTB with Liferay, when reviewer rejects the the web-content it goes with "pending" state in list view and pending(update) in full view. This is bit confusing for regular users. What I seek is, it shows "rejected" in control-panel and from there user can update the content and then re-submit. Though, default single approver workflow gives the same with "pending(update)" state. – aston Jun 28 '16 at 05:24
  • I'm not sure I'm entirely following you, but it sounds like you want to change the behavior of the search container more than the workflow behavior. Your status is probably being set in the workflow, and the search container might be configured to show only entries of a certain status. It's worth checking out. Find the JSP where the search container you're interested in is configured and search for `WorkflowConstants`. I'm just guessing here, though. – Russ Bohl Jun 29 '16 at 16:09
0

I believe you'll want to set the status to "denied" as you have done already in the update task, but then immediately, in the same action script, set the status to "pending".

Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);
Russ Bohl
  • 211
  • 1
  • 5