- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:34 PM
Hello all,
I am trying to set a value on a field which is reference field( referring to user table) based on a choice field vis catalog client script and not successful so far, can some one please help:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:42 PM
Do you want to set the same user whenever selects New Hire?
If yes go to user table and copy the sys_id of that user and copy the name of the user.
Ex:
g_form.setValue("subject_person","75826bf03710200044e0bfc8bcbe5d2b","Fred Kunde"); value+displayValue
If its dynamic use Script Include.
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:42 PM
Do you want to set the same user whenever selects New Hire?
If yes go to user table and copy the sys_id of that user and copy the name of the user.
Ex:
g_form.setValue("subject_person","75826bf03710200044e0bfc8bcbe5d2b","Fred Kunde"); value+displayValue
If its dynamic use Script Include.
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:42 PM
You just need to use
g_form.setValue('subject_person','sys_id');
Please mark answer correct/helpful based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:48 PM
Hi there,
For reference fields, please apply the value AND displayValue. This is one of the most common performance scripting mistakes.
2020-10-19 setValue() reference fields/variables, use the value AND displayValue parameter
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2022 09:58 PM