- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 03:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 03:13 AM
Hello Shweta,
configure OnChange catalog Client Script and use below logic:
function onChange(control, oldValue, newValue, isLoading) {
var id = g_form.getReference('<fieldName>');//replace 'fieldName' with the name of your reference field.
g_form.setValue('emp_number', id.emp_number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 03:13 AM
Hello Shweta,
configure OnChange catalog Client Script and use below logic:
function onChange(control, oldValue, newValue, isLoading) {
var id = g_form.getReference('<fieldName>');//replace 'fieldName' with the name of your reference field.
g_form.setValue('emp_number', id.emp_number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 03:13 AM
Hi,
Can you provide some more details to your question?
what variables are there and when should this happen? is it based on change of some other variable?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 03:17 AM
Hi there,
Not sure about your exact requirement since you didn't provide much details. Though below article might help you. Zero code involved.
2021-02-11 Catalog Data Lookup Definition on any table, eliminating Catalog Client Scripting
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field