- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 11:59 AM
I have a catalog item that auto-populates fields based on user's logged in. If you decide to change cardholder name it will auto populate based off their record as well. My question is how to I auto populate the user's manager's TITLE, and EMPLOYEE number. These variables on their records are 'title' and 'employee_number' but my script is based off cardholders record only.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:54 PM
Hello, to do this, you can create 2 catalog client scripts on your catalog item and you will need an additional field for a reference to the user's supervisor. You can choose to hide this new supervisor field using a UI policy if you wish, and it will still work:
#1 client script to populate the supervisor reference:
#2 client script to populate the supervisor title:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:06 PM
Hello
which table is your card holder field referring to ?is it not user table ?
and title and employee are also on user table right ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:54 PM
Hello, to do this, you can create 2 catalog client scripts on your catalog item and you will need an additional field for a reference to the user's supervisor. You can choose to hide this new supervisor field using a UI policy if you wish, and it will still work:
#1 client script to populate the supervisor reference:
#2 client script to populate the supervisor title:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 01:32 PM
Exactly what I was looking for, thank you so much. I went ahead and tried this out and it worked perfect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 02:06 PM
Hi,
Just to mention this for the future, the leading practice here would have been to utilize a catalog lookup definition. This eliminates the need for any scripting at all and is a very clean process to grab fields related to the user, to include their dot-walked values of manager's title, number, etc.
I'd recommend reviewing this as well: https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/product/service-catalog-managem...
So if all of those fields involved were related to the sys_user table, then the entire thing could have been handled by catalog lookup definition.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!