- 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:55 AM
Hi,
Using "getReference" is not a best practice.
I would suggest you to use a combination of client script and script include to populate these values.
Should you need help with script let me know.
Hope this helps
Regards,
Dhruv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 09:04 AM
Hi Dhruv,
Thank you for your suggestion. Could you please provide and example of what these scripts would look like.
Thanks,
Chris
- 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 05:02 PM - edited 03-15-2023 12:07 AM
Hi @chrish5 ,
You have to use GlideAjax API to get the manager name populated in the field as you have this data at the server side.
Following link will help you achieve what you are looking for
1. https://www.servicenow.com/community/itsm-forum/set-manager-name-based-on-selected-user/td-p/628461
Probably you need to modify the script include slightly to achieve what you are looking.
Please mark helpful/like if the solution is in line with your expectation.
Regards,
Gagan k