Give the User the ability to search from Last and first name when impersonating someone.

shrikarvs
Tera Contributor

How to configure the "sys_user" reference field in the impersonate modal to search with last name as well as first name when searching for a impersonate user. 

 

When a user is impersonating someone we want to give the users the ability to search with the last name as well as first name when trying to search for an user.

 

Thank you for your help

2 ACCEPTED SOLUTIONS

yago
ServiceNow Employee
ServiceNow Employee

 

If you're using the impersonation feature in the Service Portal, such as accessing /esc, clicking the profile icon, selecting the display menu, and then choosing "Impersonate," here's how you can allow searching by first and last name.

Steps:

  1. Ensure you're in the Global Scope.

  2. Edit the "Impersonate User" widget to enable additional search fields. You can access it at this URL:

    [your instance]/sp_config?id=widget_editor&sys_id=b338d7a7532120101865ddeeff7b12ae&spa=1 
  3. Update the sn-reference-picker in the template. Locate the searchField property and change it as follows:

    Original:

    searchField: 'name;sys_id;user_name;'
    

    Updated:

    searchField: 'name;sys_id;user_name;first_name;last_name;'
    
  4. Important: This is an out-of-box (OOB) widget, and the ServiceNow team may update this file in the future. To make your changes upgradable:

    • Go to:

      [your instance]/nav_to.do?uri=sp_widget.do?sys_id=b338d7a7532120101865ddeeff7b12ae
      
    • Right-click the header and select Show Latest Update.

    • Right-click the header again and choose Configure Form Layout.

    • Add the Replace on Upgrade field to the form layout.

    • Check the Replace on Upgrade checkbox and save the record.

  5. Document your changes. Keep a note of the modifications you made so you can reapply them if an upgrade overwrites the script.

 

View solution in original post

yago
ServiceNow Employee
ServiceNow Employee

Hi Shrikarvs,

it is not possible to achieve the same change for the platform view, you can't customize the Polaris App Shell. But you could search by using the wildcard "*lastNameHere" in platform to match that. 

View solution in original post

5 REPLIES 5

sago45
Tera Contributor

Hi
User can achieve this by using wildcard (*) to search in the Impersonate user modal. 
For example, *lastname

shrikarvs
Tera Contributor

yes, we can do that as well but we wanted to configure the user reference field to do It automatically without wildcard(*) .

 

although, thanks for the help

yago
ServiceNow Employee
ServiceNow Employee

 

If you're using the impersonation feature in the Service Portal, such as accessing /esc, clicking the profile icon, selecting the display menu, and then choosing "Impersonate," here's how you can allow searching by first and last name.

Steps:

  1. Ensure you're in the Global Scope.

  2. Edit the "Impersonate User" widget to enable additional search fields. You can access it at this URL:

    [your instance]/sp_config?id=widget_editor&sys_id=b338d7a7532120101865ddeeff7b12ae&spa=1 
  3. Update the sn-reference-picker in the template. Locate the searchField property and change it as follows:

    Original:

    searchField: 'name;sys_id;user_name;'
    

    Updated:

    searchField: 'name;sys_id;user_name;first_name;last_name;'
    
  4. Important: This is an out-of-box (OOB) widget, and the ServiceNow team may update this file in the future. To make your changes upgradable:

    • Go to:

      [your instance]/nav_to.do?uri=sp_widget.do?sys_id=b338d7a7532120101865ddeeff7b12ae
      
    • Right-click the header and select Show Latest Update.

    • Right-click the header again and choose Configure Form Layout.

    • Add the Replace on Upgrade field to the form layout.

    • Check the Replace on Upgrade checkbox and save the record.

  5. Document your changes. Keep a note of the modifications you made so you can reapply them if an upgrade overwrites the script.

 

shrikarvs
Tera Contributor

Thank you for your help, It is working as expected on the ESC portal. Is it possible to achieve the same for the platform view.

 

once again thank you so much for your help.