- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 10:54 AM
Hi guys,
I am trying to populate one reference field based on another reference field and am having some difficulties. I need this to be an onChange client script, not a business rule (which would be much easier to accomplish but wont fulfill the functionality that I need).
In my catalog request I have a reference to the sys_user table (tvl_name). And then I have a reference field to my u_profile table (tvl_profile). On the u_profile table there is also a reference to the sys_user table (u_name).
Catalog Item
tvl_name (ref --> sys_user)
tvl_profile (ref --> u_profile)
u_profile
u_name (ref --> sys_user)
What I need to have happen is if tvl_name is filled in with my name, go search u_profile table where u_name == tvl_name and then fill out tvl_profile with that record.
Any help would be greatly appreciated!
Thanks,
AC
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 11:15 AM
You need to use GlideAjax in your on change client script to achieve this functionality.
Please check below for more details on GlideAjax.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 11:15 AM
You need to use GlideAjax in your on change client script to achieve this functionality.
Please check below for more details on GlideAjax.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 11:19 AM
Blagh, thats what I figured. I am awful at GlideAjax. I'll give it a go 😞
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2019 04:55 AM
That was actually an incredibly helpful article and explained it super well! Was able to get it done in about 5 minutes. I'll have to bookmark that one.
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 11:26 AM
Hi Alex,
I was about to suggest reference qualifier (no script required) but that will require users to select the value from tvl_profile variable. However, if you would like to auto-populate the value then you have to do it via GlideAjax approach. Below are few links to get started.
https://community.servicenow.com/community?id=community_blog&sys_id=f8ccee25dbd0dbc01dcaf3231f961978
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference/r_GlideAjax.html
-Pradeep Sharma