How do I make e-mail updates update Work Notes instead of Additional Comments?

kh687
Giga Contributor

Out of the box Service Now updates Additional Comments with e-mails sent into a ticket. This means they are sent to the customer. I want to stop this by getting e-mails added as Work Notes instead. How do I go about doing this?

1 ACCEPTED SOLUTION

harshvardhan_11
Giga Expert

As per my understanding, you want to update worknotes with the mail body received by service now.



There must be a inbound email for your table. E.g Update Incident (BP) for incident table.



The inbound script will have a line something like


current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;




You can comment that line and write a new line


current.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;



This will update worknotes instaed of additional comments.



Note: Make sure which inbound script is running for your table. Also if the inbound script is updating worknotes somewhere else in script, you have to comment it, or append all the worknotes together.


View solution in original post

7 REPLIES 7

harshvardhan_11
Giga Expert

As per my understanding, you want to update worknotes with the mail body received by service now.



There must be a inbound email for your table. E.g Update Incident (BP) for incident table.



The inbound script will have a line something like


current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;




You can comment that line and write a new line


current.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;



This will update worknotes instaed of additional comments.



Note: Make sure which inbound script is running for your table. Also if the inbound script is updating worknotes somewhere else in script, you have to comment it, or append all the worknotes together.


Hi Harsh,



I want to do reverse of this.



I am sending an outbound email to third party, and I want to copy that email to my incident work notes. How can I copy that 'email notification body text' to my same incident work notes.. Any suggestions?



Thanks!


I think you can directly add Send/Received mails in activity logs, it will show the email which is sent and which are received. No need to add them to worknotes.




But if you want to add them to worknotes, you can add BR in email table, after the status changes to sent, add the body_text field to incident worknotes. You can use condition as "target table= incident". Incident reference you can get from target field.


So I want to do the same thing but only from a specific sender.   If I edit my Update Incident (BP) like this, will it work?   Or will it add the email to the worknotes and the comments field?



gs.include('validators');




if (current.getTableName() == "incident") {



  var gr = current;



  if (email.from().indexOf("@redacted.com")){


  gr.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;


  }



  if (email.subject.toLowerCase().indexOf("please reopen") >= 0)


  gr = new Incident().reopen(gr, email) || gr;



  gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;



  if (gs.hasRole("itil")) {


  if (email.body.assign != undefined)


  gr.assigned_to = email.body.assign;



  if (email.body.priority != undefined && isNumeric(email.body.priority))


  gr.priority = email.body.priority;


  }



  gr.update();


}