Document events

Use the document events

Document events

With the document events built in RUAL you can execute certain functions on document changes. You can use different events for every storage.
On created

  • This event will be executed whenever a document is created in the specified storage
On updated
  • This event will be executed whenever a document is updated in the specified storage
On saved
  • This event will be executed whenever a document is created or updated in the specified storage
On removed
  • This event will be executed whenever a document is removed in the specified storage

document_events.png

On updated example

In a document event you can do anything you want to execute when a document is created, updated or removed. To give a small example on what you can do when a document is updated, we have made an example On updated event.

The document events all have 3 out-pins you can use: Current Document, Revisions and Field Modified.
Current Document will contain the document which is updated and will have the newest version of the document with the updated values.
Revisions is an array with objects that contains what updates were made to the document. A revision object will have the fields key, which is the field that is updated. type, what update was made, (set.field, remove.field, array.add, etc.). value, has the new value for that field. previous_value, has the old value.
Fields Modified is an array with values. Each item in this array will be a field that has been updated, either removed, updated or created.

example.png