
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2018 04:42 PM
Is there a way to update the 'current' record after a user hits Send?
Scenario: Service Desk uses the new_call module, they want to be able to respond to inbound emails without converting to a task record.
We can do this by enabling the email client on the new call table easily enough, but what we also want is if they do this, to change the call type to something e.g. General Enquiry, and set the state to Closed, then update the record.
This way all the agent needs to do is send an email and move on.
We have access to a few things in Email Scripts, from the function i can see:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event)
There's not a whole heap of documentation on what we can do with these, is there a way to figure out when the email is sent and then call a function to update current?
My other option was to use a Business Rule on the sys_email table but that seems a bit iffy.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2018 04:51 PM
I had to write a Business Rule for this on sys_email table. You can limit the impact by setting Target Table = New Call & Type is Sent, so that you don't impact anything else. And then the script to update the target record
var email_q = new GlideRecord(current.target_table);
email_q.addQuery('sys_id',current.instance.toString());
email_q.query();
if (email_q.next())
{
email_q.comments = 'Sent By:'+current.sys_created_by+'[code]'+current.body+'[/code]';
email_q.update();
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2018 04:51 PM
I had to write a Business Rule for this on sys_email table. You can limit the impact by setting Target Table = New Call & Type is Sent, so that you don't impact anything else. And then the script to update the target record
var email_q = new GlideRecord(current.target_table);
email_q.addQuery('sys_id',current.instance.toString());
email_q.query();
if (email_q.next())
{
email_q.comments = 'Sent By:'+current.sys_created_by+'[code]'+current.body+'[/code]';
email_q.update();
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2018 04:53 PM
Thanks I'll check it out