- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 08:18 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 08:12 PM
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 12:08 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 07:51 PM
Thanks!