AnsweredAssumed Answered

Inbound rule execute pdfgen script properties NOT set! Help!

Question asked by alexr on Oct 5, 2006
I have written a Java script that performs a number of checks on a document object, creates a PDF folder space, removes an old rendition if nescessary and finally creates a pdf rendition of the document in the PDF folder space

var pdfDoc = document.transformDocument("application/pdf", pdfFolder);

Now this scripts runs fine if I do a 'on demand'  action to run this script straight against a document.
The result is a pdf rendition AND all properties of the original document are copied into this new object.

Then I added a INBOUND rule to Company Home (with inheritance to all subspaces) to execute this pdfgen script against all items and not run in the background.
Everything seems to work fine. When I create new content,aA PDF folderspace is created (if non existent), pdf rendition copy is made . However…

The properties of the original document are not copied over to the PDF rendition document like when I run the script manually against an already existing document.
It seems like the Inbound rule fires of the script in before the properties are finally set on the original during the Add/Create content phase.
Basically things run out of sync.

Is there a way to remedy this? Do I have to add a general check at the start of the script? I can't check if all properties have a value, because they are not all mandatory. Is there a different way to check if the creation of the original document has finished and the time to execute the rest for the script is right?

I was thinking something along the line the way I did at the creation of the PDF folder.  The rest of the script can only continue when the creation of the PDF folder is finished. Corresponding code snippet:

do { chkFolder = document.parent.childByNamePath("PDF");  }  while (chkFolder == null);


Alex  :)