- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2014 05:59 AM
In a workflow I am using, we have approvals going out to non-Itil users. They are provided with a link in the approval to either Approve or Reject. However, they occasionally use the "Reply" option in Outlook. This does NOT get processed correctly with the inbound mail scripts. I've tried several different approaches to handling this, but cannot seem to figure out a way to handle these emails. These emails are appended to the approval, and not to the ticket the approval is for. This means the person the ticket is assigned to doesn't get an email letting them know that the approval has been commented.
If a user replies to the approval email, I want the person that the original ticket is assigned to will get an email that the approval has been updated. I tried creating a notification on the Approval table that only gets fired if the Comments changes and if the Approval for starts with OMA. This never gets fired. I assume this is because Comments is a journal field. What I really want to happen is if an email is received by an Approval, a notfication will go out to the person that the originating ticket is assigned to.
Has anyone been able to make something similar work?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 10:03 AM
Based on everyone's feedback, I now have the notifications working. However, it fires off every time the comments are updated, which includes when it's approved or rejected. They only want the notifications to go out when someone replies to the email, not every time an approval or rejection is received. For now I am leaving it as is, unless anyone has a bright idea on how to manage this. (I'm thinking I might need an inbound email action...)
Here is what I have.
Create a new email notification.
Name: OMA Approval Commented
Table: Approval [sysapproval_aprover]
Active: True
Send to event creator: True //Make sure you check this while testing! I didn't have it checked and it took ages to figure out that's why I wasn't getting notifications
Send when: Record inserted or updated
Weight: 20
Inserted: False
Updated: True
Conditions:
Comments Changes
and Approval for starts with OMA //Only fires for my retail onboarding table, per the record naming scheme.
Who will receive
Users/groups in fields: Approval for.Assigned To //only email to the person the source ticket is assigned to
What it will contain
Email template:
Subject: ${sysapproval.short_description} -- comments added to Approval
Message:
Approval for: ${sysapproval} //ticket being approved
Approval for Ticket Number: ${sysapproval.short_description} //Short description of ticket (which includes retailer name)
Approver: ${approver} //who approves this
Comments: ${comments} //comments posted
//the following section prints a link to any attachments
<mail_script>
printattachments();
function printattachments() {
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id',current.sys_id);
gr.query();
while (gr.next()) {
template.print('<a href="http://carhartttest.service-now.com/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>\n');
}
}
</mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2014 06:38 AM
Hi Nanette,
To check if the comments field has been updated, you could use the concepts written in this blog in you business rule. You can then trigger an event to send the notifications.
http://www.servicenowguru.com/scripting/business-rules-scripting/checking-modified-fields-script/
Thanks,
Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2014 06:54 AM
Comments field on Approval table is not a journal field. It is a string field.
You can write a business rule on Approval table :
Condition: current.comments.changes()
Script :
gs.eventQueue('sendmailto.assignee','current','','');
In the email notification, the receiver should be : Approval for.Assigned to (sysapproval.assigned_to)
Regards,
Bhavesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 09:07 AM
You could put a business rule on the approval table that fires any time comments are added to the approval. The business rule could then write those comments to the comments or work notes field on the ticket and utilize the existing notification functionality around those fields changing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 10:03 AM
Based on everyone's feedback, I now have the notifications working. However, it fires off every time the comments are updated, which includes when it's approved or rejected. They only want the notifications to go out when someone replies to the email, not every time an approval or rejection is received. For now I am leaving it as is, unless anyone has a bright idea on how to manage this. (I'm thinking I might need an inbound email action...)
Here is what I have.
Create a new email notification.
Name: OMA Approval Commented
Table: Approval [sysapproval_aprover]
Active: True
Send to event creator: True //Make sure you check this while testing! I didn't have it checked and it took ages to figure out that's why I wasn't getting notifications
Send when: Record inserted or updated
Weight: 20
Inserted: False
Updated: True
Conditions:
Comments Changes
and Approval for starts with OMA //Only fires for my retail onboarding table, per the record naming scheme.
Who will receive
Users/groups in fields: Approval for.Assigned To //only email to the person the source ticket is assigned to
What it will contain
Email template:
Subject: ${sysapproval.short_description} -- comments added to Approval
Message:
Approval for: ${sysapproval} //ticket being approved
Approval for Ticket Number: ${sysapproval.short_description} //Short description of ticket (which includes retailer name)
Approver: ${approver} //who approves this
Comments: ${comments} //comments posted
//the following section prints a link to any attachments
<mail_script>
printattachments();
function printattachments() {
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id',current.sys_id);
gr.query();
while (gr.next()) {
template.print('<a href="http://carhartttest.service-now.com/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>\n');
}
}
</mail_script>