Email notification based on view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2024 09:35 PM
Hi
I am creating an change email notification and I want this email only sent when I am on a particular view, example "mobile view" instead of the default view.
Please how can I write my condition to ensure this condition is meet and that the change does not send in any other view other that the mobile view
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 12:16 AM
Hi @Lydon ,
You can achieve this by creating a custom field on the form called "is_mobile_view", and set it's value to true or false by using onload client script based on the current view. And then configure a notification and add the condition "is_mobile_view == true" to send the notification.
I've provided the step by step solution as well, you can follow this:
1) Create a Custom Field to Track View:
Add a custom field on the change request form to track when the "mobile view" is being used. For instance, a boolean field called is_mobile_view.
2) Set the Custom Field via Client Script:
Use a client script to set this field based on the view. When a user opens the record in the "mobile view," the script should set the field to true.
Client Script Example:
// Type: onLoad
if (g_view === 'mobile_view') { // add your view name instead of mobile_view
g_form.setValue('is_mobile_view', true);
} else {
g_form.setValue('is_mobile_view', false);
}
3) Create the Notification:
Create a notification that sends an email based on the value of this custom field.
Go to System Notification > Email > Notifications.
Click on New to create a new notification.
Set the Table.
Define the When to send section with conditions that include is_mobile_view is true.
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.