cancel
Showing results for 
Search instead for 
Did you mean: 

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

Sébastien_Mehr
Champ on-the-rise
Champ on-the-rise

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

4 REPLIES 4

Gregory_Carlin
Elite Collaborator
Elite Collaborator

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

Sébastien_Mehr
Champ on-the-rise
Champ on-the-rise

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

Gregory_Carlin
Elite Collaborator
Elite Collaborator

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

Sébastien_Mehr
Champ on-the-rise
Champ on-the-rise

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.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.