- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 02:28 PM - edited 11-01-2023 02:34 PM
Hi everyone,
Please I need a solution to auto populate a variable (Reference type) on a Catalog Item based on the logged in User.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 02:54 PM
Hi @ID NOBLE ,
You can add a default value to the variable so that it gets the logged in User information, for example the code below will auto populate the field with logged in user company.
javascript:gs.getUser().getCompanyID()
If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know
Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 02:58 PM - edited 11-01-2023 03:07 PM
You can go to the Default Value tab of the reference field and use the below code.
javascript: gs.getUserID()
Additionally, you can create onLoad Catalog Client Script like below
var loggedusr = g_user.userID;
if (loggedusr != ' ') {
g_form.setValue('your_field_name', loggedusr) ;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 02:54 PM
Hi @ID NOBLE ,
You can add a default value to the variable so that it gets the logged in User information, for example the code below will auto populate the field with logged in user company.
javascript:gs.getUser().getCompanyID()
If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 03:18 PM
Thank you for your help. It works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 02:58 PM - edited 11-01-2023 03:07 PM
You can go to the Default Value tab of the reference field and use the below code.
javascript: gs.getUserID()
Additionally, you can create onLoad Catalog Client Script like below
var loggedusr = g_user.userID;
if (loggedusr != ' ') {
g_form.setValue('your_field_name', loggedusr) ;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 03:19 PM
Thank you for your help. It works.