Where is e.name coming from on Ticket Conversation widget on Service Portal?

JC S_
Mega Guru

On the <h4 class="timeline-title">{{::e.name}}</h4> part of the HTML code, where is e.name coming from and how can we replace it with just the First Name of the agent that commented on the ticket instead of full name.

7 REPLIES 7

jesseadams
ServiceNow Employee
ServiceNow Employee

It comes from $scope.data.mergedEntries in the widget's controller. Ultimately that looks like it's populated by the response from the history api.


This has these fields available:



element


initials


login_name


name


sys_created_on


sys_created_on_adjusted


sys_id


user_sys_id


value



Name seems to be the most useful item here.. OOB this displays the user's first and last name which I'm guessing is because that's the display column for the user table. If you have the same configuration you could just try splitting that string and pulling out just the first name.


Do you have an idea on how we can manipulate that e.name string? Can we just refer to e.name on the Client Script and do text replace using javascript?


jesseadams
ServiceNow Employee
ServiceNow Employee

Look at the mergeStreamEntries function in the controller starting around line 87.


That's where that object gets populated with it's data. Your best bet will probably be to use the standard javascript split and/or replace functions for each entry in there.



You may also be able to use those same js functions inside the expression in the template (the {{::e.name}} part) but that's not really best practice.


Okay, we are trying to do it via the Client Script, what is the variable being returned that contains the e.name value (we plan to pass that variable to our js replace function first.) Is it the variable "entries"?