Catalog client scripts to populate logged in user

meghana23
Kilo Contributor

Requirement is to populate logged in user name.

Wrote client script of onload function just to populate logged in user

alert('welcome');
var us = g_user.userID;
g_form.setValue('caller_id',us);

even alert is not getting populated

Any suggestions

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

which form you are writing this and for native/portal?

script looks fine. please share complete script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

umaaggarwal
Giga Guru
Giga Guru

Could you please share the image of your client script with complete configurations ?

 

I used below script and works perfectly fine 

 

find_real_file.png

meghana23
Kilo Contributor

we have to write for the portal

find_real_file.png

Hi meghana 

Please change UI Type as ALL and give a try

find_real_file.png

Let me know if any,

Regards,

Rakesh