08-28-2018 12:21 PM
Hello community, i have created a rule in a folder that when users add contents to that folder the rule calls a custom script that prepends to all children nodes in that parent folder a specific char, at this point i catch the parent node based on the "document" var node that fired the rule, this works fine when creating or adding content to the folder that has configured the rule, but i need to make this work when deleting a node in that folder, the problem is that i can't get the parent property of the deleted node, I think it's because it does not exist anymore.
does anyone knows hoy can i make this work without leaving hardcoded the parent folder nodeRef?
08-29-2018 03:53 AM
Use the check "Run the rule in background" to define the rule.
08-29-2018 10:01 AM
Thank you for your response Angel Borroy, i have set the flag you told me, but it has not worked for me, i'm wondering if the RootScoped Var `document` is Defined when the rule calls my custom script on node deletion actions, because my script get the parent node based on that variable.
08-29-2018 12:18 PM
I guess that "document" should be considered as a removed node in the JavaScript API when using delete as condition on a rule.
Usually I develop a behaviour for this, but Java is required: Alfresco – Implementing delete behavior | Programming and So
08-29-2018 12:42 PM
nice! i will try using Behaviors, thanks for the reference link!
I want to share with you that i have try using the RootScoped var "Space" this worked for me, this get me the Folder parent of the uploaded Node that triggers the rule, it defines with the node of the folder where the rule is configured it works fine but i have to redefine the same rule in each folder i want the same functionality, if you link the rule to an existing one, this variable always gets defined with the Folder where the rule war originally created.
think i will continue with the script using this "Space" variable, and if theres no success i will be moving to create a behavior.
Thank you for your help Angel Borroy!
Explore our Alfresco products with the links below. Use labels to filter content by product module.