How can I copy the email sent/received from the activity log on the RITM to the sctask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 11:29 AM
I have read all of the posts I could find where this is asked but have not seen any answers. When someone replies to an email it is attached to the RITM activity log as email received. I would like to know how to copy this to the sctask activity log?
Has anyone had any success doing this?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 03:28 PM
Hi, the 'email' visible on your RITM record activity filter is the received email message. This message cannot be made visible from 2 different record activity filters\task views within the instance and creating 'fake' duplicate email messages would not be a best practice solution for your requirement.
As an alternative, during processing of the inbound message you could update your inbound action to copy key message details into the comments or work_notes journal of any child task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 02:14 PM
Hi Tony,
Thanks for the reply. Are you saying that in the inbound action called "update requested item" I can add something for the sc_task table? Would it work to just copy below and change the table name?
Here is the current script
if (current.getTableName() == "sc_req_item" && current.canWrite()) {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 02:22 PM
Hi @Cindyco
You can use same inbound action script to update comments of task with email body
if (current.getTableName() == "sc_req_item" && current.canWrite()) {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
current.update();
//This part can be used to copy same email content to sc_task
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item',current.sys_id);
grTask.query();
while(grTask.next()){
grTask.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
grTask.update();
}
//end of task updation
I have added the task comments update logic at last, you can adjust thar part in your inbound action script.
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 08:57 AM
Thanks for this I tried it and even changed request_item to sc_req_item and it did not add anything to the sc_task. Anything else you can think of?