AnsweredAssumed Answered

Problem with Script in Alfresco 3

Question asked by mrey on Oct 29, 2009
Latest reply on Oct 30, 2009 by jpotts
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

Outcomes