AnsweredAssumed Answered

Alfresco Rule - Javascript

Question asked by alfsender on Jun 25, 2013
Latest reply on Sep 10, 2013 by alfsender
Hi All,

I have created a Rule, in Alfresco which will transform all incoming document to PDF. These PDFs will be copied to Transform folder, which will in be same location as original document.

If transformation fails say for XLS file (which is password protected) then i have to copy same file to Transform folder. javascript code which i am using is as below.

      var action = actions.create("transform");
      action.parameters["destination-folder"] = transformSpaceNode;
      action.parameters["assoc-type"] = "{}contains";
      action.parameters["assoc-name"] = pdfFileName;
      action.parameters["mime-type"] = "application/pdf"; 
   // Execute
      logger.log(" Exception Occured while transformation for the Doc " +;
      // copy original doc to transform space
      var copiedNode = document.copy(transformSpaceNode);
      logger.log("After Copy :: " + copiedNode.nodeRef);

If code throws exception in Transformation, it will come to catch block and copy node to Transform space. It also displays nodeRef in logger after copy. But after executing script it does transaction rollback so node which it has copied is removed from Transform space.

please advise what should I do make it work.

Thank you.