Hi all ,How to use Get reference in onload service catalog client script ..Please help

Rishi13
Giga Contributor

g_form.getReference();

1 ACCEPTED SOLUTION

Community Alums
Not applicable

From the name of your script, I'm guessing you want to populate a field with the currently logged in user.  

For that, you could use the following line of code to set the field 'requested_for' with the current user.

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

 

You should check out this developer documentation on the GlideForm API and search for the following to see more information on how to set a value:

setValue(String fieldName, String value)

 

View solution in original post

6 REPLIES 6

Allen Andreas
Administrator
Administrator

Hello,

If you're new to ServiceNow...welcome!

With that said, please search the forums for literally what you posted:

g_form.getReference

and you'll find many posts on here about that, if you really wish to use it.

It's extremely important that you know how to search and use the tools to help you!

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Rishi13
Giga Contributor

Thanks!