Reference Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2025 08:56 PM
In catalog creation, I created one variable "requested for" type "Reference", if I login with Radha Manchi the name should be populate in that variable. How should I do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2025 09:36 PM
Hi @radhamanchi ,
Use variable type as requestor for or else use reference qualifier "javascript: gs.getUserID()"
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'.
Chandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2025 09:59 PM
Hi @radhamanchi,
Option 1: Set Default Value in the Variable (No Script Needed)
On the variable definition of your Catalog Item, go to the Default Value field and add:
>> javascript:gs.getUserID()
This method requires no client script and automatically pre-fills the reference variable with the current user's sys_id.
Option 2: Use a Catalog Client Script (onLoad)
If you want additional flexibility or are populating multiple fields based on user selection (like email, department), use a client script:
function onLoad() {
g_form.setValue('requested_for', g_user.userID);
}
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hey @radhamanchi , I have seen the below answers however, the most optimized and recommended answer would be creating a variable 'requested for' there is now an out of the box variable named as 'requested for' which will automatically fetch the logged in users details in catalog item as well as in service portal.
You will just have to select the Type itself as 'requested for'
i.e. Type - Requested For.
Here is a screenshot for better visualization.
Mark this solution as accepted and helpful as it will be helpful for other users and readers as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @radhamanchi , I hope you are doing well, If my solution helped you a bit or enhanced your knowledge can you please mark those answers as Accepted or Helpful this will also benefit the other users as well.
Regards,
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi @radhamanchi Try using variable of type 'Requested For' and set the deafult value as
javascript:gs.getUserID();