@mentions notification to include ticket details

michaelbcp
Kilo Contributor

I’m working on changing the @mentions notification to include ticket details like the short description, requested for, Requested by, and assignment details.

I’m not very good with javascripting.  I’m looking for help to create an email script that can understand which table to grab these details from and print them out into the notification.

I’m guessing the script will need to:

1. determine which table the information resides on (@mentions can happen on Incident, REQ, RITM, SCTASK, Problem, and change tickets).

2. then state what info will be needed (ie. Requested For Name, Short Description, etc)

3. validate that the info is present.

4. pull the info

5.and then print it out into the notification.

Am I on the right track?  Can anyone provide any documentation links that would help me create this (feel free to write a script if you’d like 🙂 )?

 

Thanks!

5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

Open the Notification "Activity Stream @Mention Email"

 

Remove the logo of service-now and add your. Also you can remove /add word in it. Change the Subject line

 

 

 

find_real_file.png

 

Regards,

Sachin

Hi Sachin,

 

What you're suggesting would only show the link to the ticket and not include any information about the ticket itself.  The goal is to provide the limited info already provided in the OOB script but also add details from the ticket the mention occurs in.  These details can be the short description, requested by, requested for users, or any other attribute I would like from the ticket. 

The problem is that I don't know how to tell this email script to understand what type of ticket (inc, RITM, CHG, etc) is being used and how to provide the details from specific fields i choose depending on which table the ticket resides in.


I hope that helps clear up my request.

thanks,

In your email script, you can use sys_class_name to find out source_table name( eg incident, change, request) and then print out column values of these respective tables in your email script.

 

Use below sample script for printing information about change_request

 

  var keys = [];
  var set = new GlideappSequencedQuestionSet();
  set.setTableName(current.sysapproval.sys_class_name);
  set.setTableSysID(current.sysapproval);
  set.load();
  var vs = set.getFlatQuestions();
  if (vs.size() > 0)
     printVariables(vs);

  function printVariables(vs) {
    template.space(4);
    template.print("Summary of Change request:<br />");

    for (var i=0; i < vs.size(); i++) {
         if(vs.get(i).getLabel() != '') 
            template.space(4);
            template.print('     ' +  vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "<br />");  
    }
  }

 

Regards,

Sachin 

Hi Sachin,

 

Thanks for your help, but I'm not sure how your answer will result in fields from other tables like requested for, short description, and assigned to.

 

Could you please explain further how I can get this field info to show up in a @mentions email notification?

Thanks,