Hello,
You are receiving that null pointer error because you are passing a null value to the function childByNamePath.
I think this happens beacause the rule is executed for the subfolders that are created in the process, i'm not sure that the condition with null in the rule definition work properly in this case.
Try to add a condition in the rule definition for only execute the rule for documents and add the null comparation in the script code.
Regards
It work !!!
Thank you !!!!
I just add in the rule the condition as you expected :
If in the content "BDC-SEDIT-propriete" have "XXX" (XXX = number of the metadata)
The good java command for people who needed the same as me :
var Descr = document.properties["alah:BDC-SEDIT-propriete"]; var parent = document.parent; var myfolder = parent.childByNamePath(Descr); if (myfolder === null) { myfolder = parent.createFolder(Descr); } document.move(myfolder);
To finally add some more features ine the folder's name with more metadata it look like this
var Descr = document.properties["test:BDC-SEDIT-propriete"]; var libelle = document.properties["test:BDC-SEDIT-ObjetCommande"]; var tiers = document.properties["test:BDC-SEDIT-LibelleTiers"]; var parent = document.parent; var myfolder = parent.childByNamePath(Descr + "_" + tiers + "_" + libelle); if (myfolder === null) { myfolder = parent.createFolder(Descr + "_" + tiers + "_" + libelle); } document.move(myfolder);
With this, the folder name look like this : "BDC-SEDIT-propriete_BDC-SEDIT-ObjetCommande_BDC-SEDIT-LibelleTiers"
Roberto you ownz ! if you send me private message with your postal adress i'll send you french wine ! Promise !
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.