How can I display the first name, last name, and email address in the Name column for the user table.

JR Guieb
Tera Expert

How can I display the first name, last name, and email address in the Name column for the user table.   Currently the the requested for variable is referencing the users table and displays the name field which only has the user's first and last name.   The issue we are having is that we have some users with the same name and the end user submitting an incident or request cannot distinguish which person to choose.   I do not have a good grasp at scripting so any help would be great.

Here is what we have for the script for the name column:

if (current.first_name.nil() && current.last_name.nil() && !current.name.nil()) {

  var names = current.name.toString().split(" ");

  if (names.length > 1) {

      current.first_name = names[0];

      names.shift();

      current.last_name = names.join(" ");

  } else

      current.last_name = names[0];

}  

if(current.first_name.nil()) {

      current.last_name;

  } else {

      current.first_name + ' ' + current.last_name;

  }

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

I was experiencing the same display discrepancy between the Service Catalog and ESS, and the new Service Portal until I made my Variable attributes the following:



ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,ref_ac_columns_search=true,ref_ac_order_by=name



The search and order by may not be necessary.   Now I am seeing name and email in the reference drop-down - though it seems to stack the email address beneath the name, not to the right.


View solution in original post

11 REPLIES 11

Hi Arturo,



Did you get the solution for this to append the concatenation of the first name, last name, and email fields together in the Service Portal search ????



Please let me know if you have something on this.



Thanks,


Prajwal


Hi Prajwal,



Brad Bowman provided me a solution to this.   I had to put the following in the variable attribute for the variable that references the user table:



ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,ref_ac_columns_search=true,ref_ac_order_by=name



find_real_file.png


Hello, Where can I find this page? I'm beginner in servicenow thanks for your help


JR Guieb
Tera Expert

Hi Brad,



That is correct i want the name to be a calculated field which concatenates the first name, last name, and email fields together in the Service Portal.


Brad Bowman
Kilo Patron
Kilo Patron

I was experiencing the same display discrepancy between the Service Catalog and ESS, and the new Service Portal until I made my Variable attributes the following:



ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,ref_ac_columns_search=true,ref_ac_order_by=name



The search and order by may not be necessary.   Now I am seeing name and email in the reference drop-down - though it seems to stack the email address beneath the name, not to the right.