Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get the first name of the person (agent) who updates the ticket

Pierre5
Kilo Expert

Hi there,

RE: Get the first name of the person (agent) who updates the ticket

I was wondering if anyone could help with the following. (P.S. You are dealing with a complete novice here, just so you know).

We have default emails and custom replies that are sent to 'Callers' (customer). Below is a typical example: (doesn't work)

Dear ${caller_id.name}

Thank you for contacting System Admin Services.

An ticket has been opened, reference number ${number}, and automatically assigned a priority of P${priority}.

If this is a Priority 1 incident telephone the SOC immediately on +47 (0)1539 1234567 and quote the reference number.

Investigation will begin shortly and we will update you throughout the ticket life-cycle. If you would like to post further updates concerning this ticket, please reply to this message.

Regards

${u_updated_by_name} 

Systems Administrator

I followed this article, then lost the plot.

https://community.servicenow.com/community?id=community_question&sys_id=67638b25dbd8dbc01dcaf3231f96...

 

In our replies, I want to include the first name of the agent who updated the ticket. I followed some documentation within 'Community', but couldn't get the name (first name) of the person who updated the ticket. ${u_updated_by_name} 

I created a script as suggested;

<mail_script>  
var userid = current.sys_updated_by;       // Gets the User ID
var gr = new GlideRecord('sys_user');   // Creates new GlideRecord Object
      gr.addQuery('user_name', userid);     // Queries the table for the record of our user found in line 2
      gr.query();  
      if (gr.next()) {                                                                       // If it finds one....
          var userName = gr.name;                           // set the variable "username" as the users name.
        }  
 
template.print("Updated By: "+userName);   // Print the text "Updated By:" and then the username variable from line 7.
</mail_script>

I'm probably way off the mark. Other articles seems to suggest creating a function which references a field, like the one for 'Caller' ${caller_id.name}... However!,  there's no field in my user case for the agent (person updating the ticket). If that is the case, then I guess I would need to add a field for the agent name, then hide it.

I though this would be an easy task, but finding really difficult to achieve. In a nutshell, all I want is the agents first name to be included with the signature.. Eg;

Regards,

Pierre

Systems Administrator

10 REPLIES 10

Pierre5
Kilo Expert

Thanks everyone. I will need to do some testing in DEV before I mark my request as resolved.

 

Thanks for everyone's help on this.

 

Regards,

 

Pierre