Automation chain to log audit event to two documents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2022 12:06 PM
I'm working on an automation chain that is called by an action button. The button makes a copy of the context document and assigns some new properties to the copy.
I want the automation chain to log an event (Audit.LogEvent) to the context document, and log an event to the new document created by the copy button. The chain successfully logs an event for the context document, but I'm struggling with how to get the chain to "find" the copy document so the following Audit.LogEvent can log an event to it.
Below is a simplified pseudocode version of the YAML for the chain, with the question mark representing where the copied document should be fetched.
params:
- recNumber:
type: string
- oldRecNumber:
type: string
operations:
- Context.FetchDocument
- Audit.LogEvent:
event: Log to source document
category: Automation
comment: Document.name copied from oldRecNumber to recNumber
- ?
- Audit.LogEvent
event: Log to copy document
category: Automation
comment: Document.name copied from oldRecNumber to recNumber
I'm unsure if the best way of getting the copy document is using Repository.Query or Document.FetchByProperty, and I haven't been able to find any really good examples of either one.
Any ideas would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 04:09 PM
Hello,
Using automation scripting is way easier in this context as you can store documents and variables, and it becomes simple to execute operation on each documents.
You should have a look at this code https://github.com/nuxeo/nuxeo-studio-community-cookbook/blob/master/modules/nuxeo/copy-move/modeler... and the component which was developed
Regards
