Notify by Email When a Specific Item in the Content is Updated
Overview
The {assign_globals}
Smarty plugin allows you to assign globally shareable variables between triggers called within the same request.
This allows you to compare the values before and after the update of the content.
In this tutorial, we will implement a feature to notify by email when a specific item in the content is updated, as an example of using {assign_globals}
.
What you'll learn
In this tutorial, you will learn how to implement a feature to notify by email when a specific item in the content is updated, following these steps:
Set up an item in the content structure
Set up an extension item that will be the target of comparison in the content structure.
Set the following extension item in any content structure:
Parent field | Field name | Field settings |
---|---|---|
None | Item Name: Status | Single choice InputRequired 1: 1 2: 2 3: 3 |
Once the content structure is ready, add a test content.
Set up custom function
Once the content is ready, write the custom function.
Click [Operations] -> [Custom function].
Click [Add] to create custom function for "Before updating content" and "After updating content".
Before updating content
Write the processing that will run before updating content, assigning the value of the content before the update to a global variable.
Item | Value |
---|---|
Title | capture_before_update_content |
Identifier | capture_before_update_content |
Trigger | Before updating content / Specify the ID of the target content structure |
Processing | The following content |
loading...
Once you have entered the information, click [Add] to add the custom function.
After updating content
Write the processing that will run after updating content, comparing the value before and after the update assigned to the global variable, and sending a notification email if there is a change.
Item | Value |
---|---|
Title | compare_before_and_after_content |
Identifier | compare_before_and_after_content |
Trigger | After updating content / Specify the ID of the target content structure |
Processing | The following content |
loading...
Please change the part to='test@example.com'
to your own notification destination.
Once you have entered the input, click on [Add] to add custom function.
Verify the operation
When you update the status item of the content added for testing, the values before and after the update will be notified as shown below.
Related documents
Support
If you have any other questions, please contact us or check out Our Slack Community.