cancel
Showing results for 
Search instead for 
Did you mean: 

documentn transfer problem in groupreview

rajanigupta
Champ in-the-making
Champ in-the-making
hiiiiii all,
I am using "parellelreview_groupprocessdefinition" for review and approval in advanced workflow :arrow:

I am starting advanced workflow  on document in "pending for approval" space and I want the document to move in "approved" space after approval.Please tell
me where and what changes should I made in my script :!:  :!:  :!:  :!:
the script s below…..


<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfSmiley Tonguearallelgroupreview">

    <swimlane name="initiator"></swimlane>

    <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator" />
        <transition name="" to="startreview"/>
    </start-state>

    <node name="startreview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{people.getMembers(bpm_groupAssignee)}</foreach>
            <var>reviewer</var>
        </action>
        <event type="node-enter">
            <script>
                <variable name="wf_approveCount" access="write" />
                <expression>
                    wf_approveCount = 0;
                </expression>
            </script>
        </event>
        <transition name="review" to="review" />
    </node>

    <task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
        </task>
        <transition name="reject" to="endreview" />
        <transition name="approve" to="endreview">
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
            </script>
        </transition>
    </task-node>

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <event type="node-enter">
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_reviewerCount" access="write"/>
                 <expression>people.getMembers(bpm_groupAssignee).length;</expression>
              </script>
           </action>
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_requiredPercent" access="write"/>
                 <expression>wf_requiredPercent = wf_requiredApprovePercent;</expression>
              </script>
           </action>
           <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                 <variable name="wf_actualPercent" access="write"/>
                 <expression>wf_actualPercent = ((wf_approveCount * 100) / people.getMembers(bpm_groupAssignee).length);</expression>
              </script>
           </action>
        </event>
        <transition name="reject" to="rejected" />
        <transition name="approve" to="approved">
            <condition>#{wf_actualPercent >= wf_requiredApprovePercent}</condition>
        </transition>
    </decision>
              
    <task-node name="rejected">
        <task name="wf:rejectedParallelTask" swimlane="initiator" />
        <transition to="end" />
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedParallelTask" swimlane="initiator" />
        <transition to="end" />
    </task-node>

    <end-state name="end"/>

</process-definition>
7 REPLIES 7

alejandrosl
Champ in-the-making
Champ in-the-making
Hi,

assuming that both spaces depends on the same root space, you should use something like this:

<task-node name="approved">
<task name="wf:approvedParallelTask" swimlane="initiator" />
<transition to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
<variable name="bpm_package" access="read" />
<expression>
var origin = bpm_package.children[0].parent;
var root = origin.parent;
var destination = root.childByNamePath("approved");
if (destination == null)
{
     destination = origin.createFolder("approved");
}
                                                      
for (var i=0; i &lt; bpm_package.children.length; i++)
{
     bpm_package.children[i].move(destination);
}   
</expression>
</script>
</action>
</transition>
</task-node>

rajanigupta
Champ in-the-making
Champ in-the-making
hi
Thanks 4 ur reply.
It really worked.I am so happy Smiley Very Happy
Please will u do me a favour…
1–If  initially document is in "companyhome/Intranet/pendingforapproval " space and I want it to move in companyhome/Intranet/approved
then what changes will I have to made?

2-Right now I add a content and go to the more actions button and click on start advance workflow….Please tell me if it can be automatically started?


thanks in advance

alejandrosl
Champ in-the-making
Champ in-the-making
1.- Nothing, if both spaces (pending & approved)depends on the same root space the previous code is ok.

2.- Take a look at this thread http://forums.alfresco.com/en/viewtopic.php?f=34&t=13617&p=53047&hilit=workflow+history#p45068

rajanigupta
Champ in-the-making
Champ in-the-making
hii
Thanks 4 ur reply

my problem is that when I am running the script it is creating a folder in "pendingforapproval " space ;as I started my workflow in
pendingforapproval space

alejandrosl
Champ in-the-making
Champ in-the-making
Yes, you're right, I was missing that. Change


if (destination == null)
{
     destination = origin.createFolder("approved");
}

for


if (destination == null)
{
     destination = root.createFolder("approved");
}

or simply, if you're pretty sure that approved folder already exists, delete that part.

rajanigupta
Champ in-the-making
Champ in-the-making
thanks 4 ur response

I tried to automate the workflow.I selected my definition of workflow as given in the thread……
but still I have to  select "start advance workflow"  from the options
Please suggest something

pankaj_p_mishra
Champ in-the-making
Champ in-the-making
Hi All,
There is some issue when i am trying to use groupreview process .
Probs…
1> It create new folder named Approved as a child of parent folder ( within parent folder)
2> when that Approved folder already present it generate error message (Please correct the errors below then click OK.

    * A system error happened during the operation: 09220017 Failed to signal transition {0} from workflow task {1}.
)
3> i want to create one another folder named "Approved_1" like that??? :?:  :?:  :?:  :?:  :?:
==========================================================================================================
NOW I WANT WHEN PERSON BELONGING TO FOLDER APPROVED AND APPROVED_1 SUBMIT THERE RESPONSE AS "APPROVED" THEN CONTENT OF APPROVE OR APPROVE_1 MOVE INTO NEXT FOLDER "APPROVED_FINAL".
OTHERWISE IF ANY PERSON EITHER APPROVE OR APPROVE_1 "REJECT" THEN CONTENT SHOULD NOT BE MOVED INTO APPROVED_FINAL.
"CONCEPT OF JOIN…"
=============================================================================================================
GIVE ME SOME ADVICE FOR THAT HOW TO IMPLEMENT THAT……
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.