OnLoad Client Script - How to auto populate / fill up user details for the fields ??

Jason Lau Chang
Giga Contributor

Hi Team,

Would like to create the OnLoad Catalog Client Script that when the user is loading the form, it will auto populate / fill up some user details in the form, how do I start ??

Thank you!!

 

1 ACCEPTED SOLUTION

Hi Jason

Basically you want to populate the requested for as soon as the form loads

If yes there are 2 ways 

1.Default Value :You can use it by modifying the variable default value

find_real_file.png

 

2. In onload client script use

g_form.setValue('requested_for',g_user.userID);

Regards

Pranav

 

View solution in original post

10 REPLIES 10

Hi Jason

Basically you want to populate the requested for as soon as the form loads

If yes there are 2 ways 

1.Default Value :You can use it by modifying the variable default value

find_real_file.png

 

2. In onload client script use

g_form.setValue('requested_for',g_user.userID);

Regards

Pranav

 

Hi @Jason Lau Chang Kwang 

Hope you are doing good.

Is this question resolved or you need some more assistance?

If your query is resolved then please mark the correct response so that this thread can be closed.

Regards

Pranav

 

 

Hi Pranav, 

Thanks for your advice, the options 2 helped!!

 

Apeksha Joshi
Kilo Guru

Hi there ,

 

As pranav has given you two ways to populate the user details according to the user reference field you can try those they are correct .

or

if you want to set the current logged in user details in those variables then you can also set the default value of the variable.

 

eg. 

gs.getUser()

gs.getUser().getFirstName()

gs.getUser().getLastName()

gs.getUser().getEmail()

gs.getUser().getLocation()

gs.getUser().getDepartmentID()

gs.getUser().getManagerID()

 

just set these in the variable's default value it will get the current logged in user deatils.

If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons!

Regards,

Apeksha

Hello @Apeksha Joshi , I am not able to get the user details even after setting the variable's default value.

can you help me out?