- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 07:46 AM
I have the below onLoad catalog client script to populate fields on my request form. The "Name' field is populating fine, but the manager field where I'm trying to just pull in their name is not and looks like this. What am I doing wrong?
function onLoad() {
var reqf = g_form.getReference('requested_for',getInfo);
}
function getInfo(reqf)
{
g_form.setValue('name', reqf.name);
g_form.setValue('manager', reqf.manager.name);
g_form.setValue('department', reqf.department);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 10:52 PM
Hi,
Please follow the below link for an example :-
https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet/ta-p/2312430
Hopefully this is a good start.
Regards,
Dhruv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 07:57 AM - edited 03-14-2023 07:58 AM
Dot walking doesn't work on the client script. Use GlideAjax instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 08:24 AM - edited 03-14-2023 08:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 11:13 PM
Hi Chrish,
As suggested in comments before you need to use GlideAjax & Client Script to make it work. Or if you wish to use the existing code that you use, you can try to use something as below & change the variable type for Manager to Reference instead of String field.
function onLoad() {
var reqf = g_form.getReference('requested_for',getInfo);
}
function getInfo(reqf)
{
g_form.setValue('name', reqf.name);
g_form.setValue('manager', reqf.manager);
g_form.setValue('department', reqf.department);
}