As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
bpm_package.children[0].setPermission["John Doe, 'contributor' "];
bpm_package.children[0].setPermission("Editor","John Doe");
<task-node name="reviewTask"> <task name="ziswf:reviewTask" swimlane="quality_manager"> <event type="task-create"> <script> </script> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> var ziswfcontentdesc = bpm_package.children[0].properties["cm:description"]; if (ziswfcontentdesc != '') { taskInstance.setVariable("ziswf_fileDescription",ziswfcontentdesc); } //It works fine here bpm_package.children[0].removePermission("All"); bpm_package.children[0].setPermission("Editor","lovrog"); </script> </action> </event> <event type="task-end"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <variable name="ziswf_qmanager" access="write"/> <expression> if (taskInstance.actorId != null) people.getPerson(taskInstance.actorId); else person; </expression> </script> </action> </event> </task> <transition name="reject" to="rejectedTask" /> <transition name="approve" to="isDirectApproved" > <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> var carrier = ziswf_carrier.properties["cm:userName"]; bpm_package.children[0].properties["zis:QualityManager"]=ziswf_qmanager.properties["cm:userName"]; bpm_package.children[0].properties["zis:Requester"]=initiator.properties["cm:userName"]; var pendingfolder = companyhome.childByNamePath("/Intranet/Quality Management/Pending"); //Here is the problem, the following code marked as comment won't work //bpm_package.children[0].takeOwnership(); //bpm_package.children[0].removePermission("All"); //bpm_package.children[0].setPermission("Editor", "zvonimirk"); bpm_package.children[0].save(); if (pendingfolder != null) { bpm_package.children[0].move(pendingfolder); } </script> </action> </transition> </task-node>