Need to send notification if someone replies to an Approval, rather than Approves or Rejects it

nluoma
Kilo Sage

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!

1 ACCEPTED SOLUTION

nluoma
Kilo Sage

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>


View solution in original post

5 REPLIES 5

Hi Nanette,



how about adding below mentioned code in advanced conditions for your email notification?



!(current.state.changesTo("approved") || current.state.changesTo("rejected"))



This will be checked in addition to "comments.changes" condition already set.



Thanks,
Mandar