cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Script in Alfresco 3

mrey
Champ in-the-making
Champ in-the-making
Hi all

We are having a problem with a Script from the Alfresco JavaScript API that we have built in a previous version 2.9 and which workded fine and that now in Alfresco 3.0 (new system we have installed to move the data to) is crashing and we dont know why as it is pretty simple

Basically what we want to do is creating a script to be executed by a space rule so when a pdf document appears in the space, the script should look for a "tiff" document with the same name in the same space and remove it.

As I said it is pretty simple and it worked fine in 2.9. Here is the code:
var nombrepdf = document.name;
var nombretif = nombrepdf.replace("pdf","tif");
var borrado = space.childByNamePath(nombretif);

/*Finds the pdf in the space and deletes the tiff*/

   if (borrado != null)
   {
     borrado.remove();
   }
Now this gives us this error:
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/21b13f3c-6e64-4185-96e5-2acb8377e4c9

Any ideas of what is wrong????

Thanks a lot
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
I've tested your script in both 3.2 Enterprise Beta and 3d Labs and it works fine. I suspected maybe it was a problem of your script finding the deleted node, so I tested it more than once but I couldn't get it to fail.

Have you stepped through your script with the Rhino JavaScript debugger GUI to see if that gives you any idea what's happening? For example, can you confirm that the node ref it complains about not being able to find is actually the node ref of the file with TIF in the name? (Like maybe it is finding the wrong node or something).

Also, where are you running the script from? Maybe you are executing the script and it is working fine, but then something else is trying to work with the node (like a behavior, for example) and it is choking because the node's been removed?

Jeff