Skip to content

Prevent unnecessary notifications from being sent out #1516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var emailGR = new GlideRecord('sys_email');

// Query for the emails you want to ignore
emailGR.addQuery('state', 'ready'); // Only emails that are ready to send
emailGR.addEncodedQuery("sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()"); // Optional timeline filter

// Set the fields to ignore and update all matching records at once
emailGR.setValue('state', 'ignored'); // Set state to "ignored"
emailGR.setValue('type', 'send-ignored'); // Set type to 'send-ignored'
emailGR.updateMultiple(); // Bulk update all matching records

gs.info('All relevant emails have been marked as ignored.');
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Created a background script to prevent unnecessary notifications from being sent out.
It helps in managing the volume of emails being sent so that we do not send the notifications even by mistake.
This script is mostly used in dev or uat to avoid any notifications being sent from lower instances.

We are querying the sys_email table to find all the emails with below queries:
--> emails with state as "ready"
--> emails that were created on today (optional query, if not added all the mails with state as "ready" will be considered for getting ignored.)

Post query we are setting as below:
--> state of the email to "ignored"
--> type of the email to "send-ignored"

After setting the fields we are updating the records.

Please be cautious while using the script in Production environment.
Loading