- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2024 06:14 PM
I had a problem with an email not triggering when a record is updated, and I figured out I could get it to trigger if I updated the record manually. Unfortunately, the record is supposed to be updated by a business rule script, and the email isn't triggered when the record is updated this way. Does anyone have any idea why the email detects a manual update, but not an update performed by the business rule? Is there anyway I can get the email to trigger when the record is updated by the business rule?
For reference, this is the part of the business rule that updates the record:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2024 07:01 PM
The key issue seems to be the use of setWorkflow(false), which might prevent the email from triggering.
If you don't need to prevent the workflow,
try enabling it. Alternatively, you can manually trigger the email after the update() call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2024 10:52 PM
Hi @Abbottronix adding to @Amit Verma
Use Script Action instead of a Business Rule. Script Actions are designed to trigger events, including email notifications.
sample Script :-
var gr = new GlideRecord('your_table_name');
gr.addQuery('sys_id', current.sys_id);
gr.query();
if (gr.next()) {
var newGr = new GlideRecord('your_table_name');
newGr.sys_id = gr.sys_id;
newGr.your_field_name = 'new_value';
newGr.setWorkflow(false); // Set workflow to false
newGr.update();
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/