Trigger an automation script when a child is created or deleted from a folderish document

I try to trigger an automation script when a child is added or deleted from a folderish custom document. I have a simple automation script with a console.log message to test the trigger.

I've created an event handler with document.modified event in Nuxeo Studio. In event handler activation, I've selected the local type of my custom folderish document.

In Web Ui, when i add a new document on this folderish document, the automation script is triggered (i see my console.log message in the server.log file) but when i delete a document in the same folderish document, there is no trigger.

I've also tried the Event Children order changed with no results.

Do you have any suggestion to handle this trigger ?

Thanks in advance for your help.

Seb

0 votes

4 answers

86 views

ANSWER



Hello,

In this case, it's more suitable to add an event handler on the children document rather than the container: In your event handler condition, just add a filter checking the parent document type, and it's OK.

For the events you would have to listen, you should have Document deleted, Document trashed , Document Created, Document imported. If you want to track if a children is modified, you have to listen to the Before document modification event (make sure you're not saving anything in the corresponding automation chain). If you listen to the Document modified, there's some chances you're running into infinite loops.

Regards

1 votes



Thanks for the ticket ! I keep in mind the custom event importation, but as far as possible i wish to set my project with a “standard” configuration.

0 votes



Hello,

See screenshot: there's indeed a formatting issue, I'm gonna create a JIRA ticket to fix it.

Remember also you can always import custom events from the Studio Event Registry.

Thx

0 votes



Hello,

Thank you very much for your help. I've just created an event listener on my child document type but i'm now stuck with the Document trashed event. I can't find it in Nuxeo studio : type an image title

Am i missing something ?

Seb

0 votes