How to populate manager name on request form?

chrish5
Giga Guru

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?  

 

chrish5_0-1678805055033.png

 

 

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);
}

1 ACCEPTED SOLUTION

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

View solution in original post

7 REPLIES 7

Sidhima S
Tera Expert

Dot walking doesn't work on the client script. Use GlideAjax instead.

 

Reddy
Kilo Sage

@chrish5 You can update the manager variable default value as below.

 

Capture.PNG

 

 

 

 

 

 

Jaspal Singh
Mega Patron
Mega Patron

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);
}