Trigger an automation script when a child is created or deleted from a folderish document
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 04:50 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2020 07:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 04:40 AM
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 :
Am i missing something ?
Seb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 05:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 07:57 AM
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.
