AnsweredAssumed Answered

Script not executing properly on a rule

Question asked by bengrah on Oct 14, 2010
Hi all.

This is a very simple script:

var newDocFilename = "Test Doc.txt";
var folderNameProperty =["cm:name"];
var newDoc = space.createFile(newDocFilename);

newDoc.mimetype = "text/plain";

newDoc.content = "Name property of this document is " + folderNameProperty;

That creates a new file called "Test Doc.txt", gets the name property of the space the script is running in, creates the new file, and places the name property value in the content of the text file. When I execute this script as part of a Run Action, it works fine. When I try and execute the script on a Rule, when content is created within a folder, I get this error:

Failed to create content due to error: 09140210 Failed to execute script 'workspace://SpacesStore/ea12f862-9810-4a3f-aad4-0983f858a06a': Existing file or folder Test Doc.txt already exists

Even though Test Doc.txt doesn't exist in that folder. I'm sure I'm just missing something here, anyone any ideas? Thanks.