cancel
Showing results for 
Search instead for 
Did you mean: 

Applying Aspect to content while approving

sradha
Champ on-the-rise
Champ on-the-rise
Hi,

I want to add some aspect to content while reviewer approving the content.I am using "Review and Approve" workflow .Is it possible?
Can anybody help?
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
Yes it is possible.

You need to insert the little piece of script in the process definition file to achieve this.
During transition you need to execute that script which will add your aspect in the document.
Other way is if you are moving the document to other space during approval then you can create rule on the approval related space that whenever any document enter in that space attach your aspect to it.

sradha
Champ on-the-rise
Champ on-the-rise
Hi,

I have added code to reviewprocessdefinition.xml.Can you tell me how get the aspect value calling webscript?

   <task-node name="approved">
     <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               for (var i = 0, child = null,
                    l = bpm_package.children.length; l > i; i++)
               {
                  child = bpm_package.children;
                  child.properies["kb:docstatus"] = "Approved";
                  child.save();
               }
            </script>
         </action>
      </event>
        <task name="wf:approvedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

Can you please post some link to refer ?

mitpatoliya
Star Collaborator
Star Collaborator
You need to add that during the transition to approve.


<task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <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="approve" to="approved" >
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
            if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
           bpm_package.children[0].addAspect("cm:approved");
            bpm_package.children[0].properties["cm:approvedAt"]= new Date();
           bpm_package.children[0].save();
           </script>
         </action>
      </transition>
        <transition name="reject" to="rejected" />
    </task-node>

sradha
Champ on-the-rise
Champ on-the-rise
Hi Mits,

How can I see the saved aspect value? Is there any way to display content metadata in workflow page?



Regards,

Sradha