- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 09:40 AM
Hello,
How would I update a record every time an email is generated and sent, say, from a incident?
I've looked into Email Client templates and doing a mail_script to update the record but that only runs when the email is composed.
Here is an image for how to generate an email from a record:
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 10:43 AM
Hi Patrick:
You can define a "after update" Business Rule on the sys_email table with the conditions State is Processed AND Type is sent and put the code for updating the Incident table in the Advanced section.
However, you will also need to define a way to figure out if this email was sent from the Incident form so that the logic is not triggered for every email that is sent out.
Hope that helps.
PS: Please hit "Correct", "Helpful" or "Like" depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 10:11 AM
It looks like you could potentially add a business rule to the sys_email table. Check if there is an entry for the email in sys_email_log. If not, then run the code you want to run on the incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 10:43 AM
Hi Patrick:
You can define a "after update" Business Rule on the sys_email table with the conditions State is Processed AND Type is sent and put the code for updating the Incident table in the Advanced section.
However, you will also need to define a way to figure out if this email was sent from the Incident form so that the logic is not triggered for every email that is sent out.
Hope that helps.
PS: Please hit "Correct", "Helpful" or "Like" depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2023 01:31 AM
Hi Pareshwagh,
Where is code please send the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2020 10:55 PM
Additionally you can enhance the filter to only work on email client tickets by adding the condition.
- Error String > Changes from > User did not press the Send button in Email Client
- Type > is > send-ready
i have also used the following script so that in only updates the timestamps of the record.
(function executeRule(current, previous /*null when async*/) {
var email_q = new GlideRecord(current.target_table);
email_q.addQuery('sys_id',current.instance.toString());
email_q.query();
if (email_q.next())
{
//just updates the time stamp of the record.
email_q.setWorkflow(false);
email_q.update();
}
})(current, previous);