How to post an email response to the Activity of the parent RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2017 04:21 PM
Hi Community,
I have enabled the option email in the SCTask form, in such a way that end users(fulfiller) can send emails directly to the requester, therefore I have this inbound action that is triggered when a requester replies back to xxxxxxx@servicenow.com email with additional comments on SCTASK
End users can see sent/received e-mails activity in activity log on SCTask form.
BUT I want that when an end user sends an email from SCTask form, the replies of the requester go to the RITM form in the activity log.
How can I modify this script to achieve it?
Thank you
Lex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2017 06:26 PM
I havent tried doing the same but you can try something like this.
if (current.getTableName() == "sc_task") {
var gr=current.requested_item;
gr.comments= "reply from: " + email.origemail + "\n\n" + email.body_text;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 06:03 AM
it didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 06:24 AM
Hello Lex,
Recently I was working on a task where I had to ensure that once a user is mentioned into the Activity feed of a Change Task record -> then he will receive an email containing link to the Change Task record, the Short Description of this record, the user who mentioned him + the work notes of this user.
In addition, if the recipient decides to reply to the received email via Outlook -> the reply will be added into the Activity feed of the Change Task record.
In order to achieve this, I made a copy of the default Activity Stream @Mention Email Notification, by addressing it (the custom one) to Notifications (live_notification) table. I marked it to run when record is inserted or updated & checked the Omit watermark option. In addition, I modified the default ng_activity_mention_body Email Script. This is actually the Email Script of the default Activity Stream @Mention Email Notification. I may say that I modified the default Email Script by just adding some lines to it. You may take a look at my script below:
var recordGR = new GlideRecord(current.table);
if(recordGR.get(current.document)) {
email.setSubject("You have been mentioned in " + recordGR.getDisplayValue());
template.print("<p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'>You have been mentioned by " + current.user_from.name + " in <a href='/" + recordGR.getRecordClassName() + ".do?sys_id=" + recordGR.getUniqueValue() + "'>" + recordGR.getDisplayValue() + ".</a></p style='color: #424E5B;margin: 0 0 12px;line-height: 26px;margin-bottom: 12px'><p>Short Description: " + recordGR.getDisplayValue("short_description") + "</p>");
if (current.field_name == "comments") {
template.print(recordGR.comments.getJournalEntry(1) + "<br />");
}
else if (current.field_name == "work_notes") {
template.print(recordGR.work_notes.getJournalEntry(1) + "<br />");
}
}
After I was ready with the custom Email Notification and Email Script - I performed some tests and confirmed that the requirement has been successfully completed. Now, by addressing the custom Email Notification to run against Notification (live_notification) table - the same scenario works for couple of tables: Change Request, Change Task, Incident, etc.
I did not create any Inbound Actions, or at least I do not remember. Simply activated all email receiving / sending options of my SNOW instance.
I am pasting some screenshots of the tests below:
- this is the email notification which I received after I was mentioned in the Activity of the Change Task record + the reply I am writing;
- this is how the Change Task record gets updated, after I reply through my email:
I believe this approach might be of use for you. I've tested it with Catalog Task record (sc_task table). It works as the example above. If it suits you - go ahead and try it
Best Regards,
Georgi Mavrodiev
IT Consultant
Do It Wise
You may visit us in our Web Site: www.doitwise.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2018 06:25 AM
Please try the following code :
var parent = new GlideRecord(request_item);
parent.addQuery("sys_id",current.document_id);
parent.query();
if(parent.next()){
// parent.comments = "Approval request for this record updated by different user "+"\n\n"+"reply from: " + email.from + "\n\n" + email.body_text;
parent.work_notes = "Approval request for this record updated by different user "+"\n\n"+"reply from: " + email.from + "\n\n" + email.body_text;
parent.update();
}
// parent.update();
//current.update();