On demo catalog item, populate the phone number and email of current user from the user table.

pk16514
Tera Contributor

How to solve the above problem, using client script methods g_form and g_user only

2 ACCEPTED SOLUTIONS

Maik Skoddow
Tera Patron
Tera Patron

Hi @pk16514 

it's not recommended to do this on client-side as the code might not work in all experiences. Instead, do this in the catalog item. The following article explains how to do that: https://blog.snowycode.com/post/how-to-auto-populate-the-current-user-in-servicenow

Maik

View solution in original post

VaishnaviShinde
Kilo Sage

Hello @pk16514 ,

 

Instead of using client script. You can populated email and phone number by using default value.

Add below in default value to that variables :

javascript:gs.getUser().getRecord().getValue('phone_number');//phone number

javascript:gs.getUser().getRecord().getValue('email');//email

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

 

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @pk16514 

 

Use the Auto populate feature on SN release in Utah.

 

LearnNGrowAtul_0-1704285903850.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************