Showing results for 
Search instead for 
Did you mean: 
Member II


I have made a script to set the document type depending of word of their name.

if (document.parent.hasAspect("pp:freightFolder")) {
var file =;
var dict = new Object();
document.addAspect('pp:document');["pp:refBlNumber"] =['pp:bl_number'];["pp:refHblNumber"] =;["pp:refContainers"]['pp:containers'];

dict = {
"Proform Invoice":"PIN",
"PI":"Proform Invoice",
"PIN":"Proform Invoice",
"Packing List":"Packing List",
"PKL":"Packing List",
"PKG":"Packing List",
"Packing List Cropped":"Packing List Cropped",
"Cropped":"Packing List Cropped",
"PKC":"Packing List Cropped",
"Invoice & Packing List":"Invoice & Packing List",
"IPK":"Invoice & Packing List",
"Arrival Notice":"Arrival Notice",
"ARN":"Arrival Notice",
"Freight Invoice":"Freight Invoice",
"FIN":"Freight Invoice",
"Bill of Lading":"Bill of Lading",
"BOL":"Bill of Lading",
"Telex Release":"Telex Release",
"TXR":"Telex Release",
"Release":"Telex Release",
"Custom Entry":"Custom Entry",
"Custom":"Custom Entry",
"Entry":"Custom Entry",
"All Docs":"All Docs",
"ALL":"All Docs"

for(var key in dict) {
      if (file.toLowerCase().search(key.toLowerCase()) != -1) {["pp:docType"] = dict[key];
         if (dict[key] == "Packing List" || dict[key] == "Packing List Cropped"){
            document.addAspect('ppSmiley TongueackingRefNumber');
         if (dict[key] == "Invoice" || dict[key] == "Invoice & Packing List" || dict[key] == "Freight Invoice") {


As you can see, in this script I assign to some docs the type "invoice".

This Invoice type has a property called invoiceStatus with a DEFAULT VALUE: "Not Processed".

Ok, knowing this, here come the problem:

I also have a smart folder, with this query: "query": "=pp:invoice_status:'Not Processed' and =pp:docType:'Invoice'"

When I add a file with a string invoice inside its name, it change its name and assign the type invoice to the file, and i suppose the default value with it.

But when I go to the smart folder to check if the file is in it. It doesn't!!!!

I have to go to the file, open its properties (all properties are there) and just save the file (without modifying nothing). Then I can go to the smart folder and there it is!

It seems that when I assign a property to a document using a script it does not really assign the default value.

I made a second test:

I create a simple rule, where: if a document is create and its a type is "content", and the name begins with invoice, then assign specilizetype "invoice".

When I drag and drop a file with name begining with Invoice, the rule assigns it the typ invoice, and it assigns the default value pp:invoice_status:'Not Processed', and then when I go to the smart folder it appears.

My conclusion is that when we use a script, default values are not being assigned. Some one can confirm me that? Or there is a real problem here?

1 Reply

Re: script

After you drop a doc into your folder to trigger the rule, and before you edit the document, have you gone into the node browser to inspect the value of pp:invoice_status? I think it might be instructive.