Triggers: Difference between revisions

16 bytes added ,  10 November 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 239: Line 239:
===== New entry in one library triggers new entry in another =====
===== New entry in one library triggers new entry in another =====
Suppose that after a new application for membership is validated, a new member should be created. We have libraries Applications & Members. After a new Applications entry is entered and before it is saved, we want to validate the application, and if it passes, we want to create a new entry in Members.
Suppose that after a new application for membership is validated, a new member should be created. We have libraries Applications & Members. After a new Applications entry is entered and before it is saved, we want to validate the application, and if it passes, we want to create a new entry in Members.
:; Set library permission: The Applications library must be permitted to access other libraries. Within Triggers, press the shield icon to view Permission settings.
:; Set library permission: The Applications library must be permitted to access other libraries via libByName(). Within Triggers, press the shield icon to view Permission settings.
:; Add new trigger: Add a new trigger to the Applications library. Set Event '''Creating a new entry''', Phase '''Before saving the entry'''. (A similar script could be set for Event '''Updating an entry''' Phase '''Before saving the entry''', but only if a change in a field value is to trigger the add of the new member.)
:; Add new trigger: Add a new trigger to the Applications library. Set Event '''Creating a new entry''', Phase '''Before saving the entry'''. (A similar script could be set for Event '''Updating an entry''' Phase '''Before saving the entry''', but only if a change in a field value is to trigger the add of the new member.)