AnsweredAssumed Answered

New Action in Alfresco Share

Question asked by massanen on Sep 21, 2011
Latest reply on Sep 23, 2011 by massanen
hi everybody,
I've got a pretty urgent problem and at the moment, even seemed that it's really easy, I couldn't solve it. Let's see:

I'm working with Alfresco Share 3.4.d, and in the documentlibrary, in a personal space that I've created, I have a list of folders representing workflow spaces. I've got "creation", "edition", … What I have to do is to move a folder (not a document) through these state-folders. So what I did was to create some rules in every state-folder, with the idea that my elements (folders) changed its state-folder when a specific metadata was changed. I did it with the next simply Script (this script pretend to move my element (the folder) from "creation" to "edition"):

var Folder_edi = space.parent.childByNamePath("Edition");
if (Folder_edi == null)
{
   Folder_edi = space.parent.createFolder("Edition");
}

if(Folder_edi != null && Folder_edi.hasPermission("CreateChildren"))
{
   var childrenList = space.children;
   for (var i = 0; i < childrenList.length; i++) {
      var copy = childrenList[i].move(Folder_edi);
      if(copy != null)
      {
         childrenList[i].save();
         //space.save();
      }
   }
}

Here two problemes: 1) Once I executed this script in the state-folder, when I came back to the same folder and I try to set the rules, the next typical alfresco Error is thrown "A problem has ocurred. This page could not be rendered…" bla bla bla. 2)My client wants that the element (the folder) change its state-folder with an action, not with a meta-data modification.

Ok. So what I did was follow these steps: http://wiki.alfresco.com/wiki/Custom_Document_Library_Action , and in this example they do a new action that throws a web sccript. So, following these steps I have not any result. When I click my button action, it doesn't do anything.

Do you know any other solution?? any advice?? what typical mistake I must be doing with the web script?? in the link's example, they do a document backup, and I've to do a move of a folder (not a document), it is not a problem, isn't it??

If you could help me, I'll be really grateful…

Outcomes