Auto populate field on catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:38 AM
Hi Everyone,
I have one custom field on catalog item - Requester (this is reference field to User table). I have to auto populate this field with current logged in user whenever I open this catalog item.
Please suggest some way.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:44 AM - edited 09-23-2024 02:48 AM
Hi @Abhijit Das7,
This functionality is available for you out of the box. Simply change or make sure your variable 'Type' is 'Requested For'.
It will auto populate with the logged in user.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:48 AM
Hi @Abhijit Das7 ,
Please use the below method in the Requested For field:
gs.getUserID(); -> Auto-populate logged in user.
Please mark it as "Helpful" and "Accepted", if the solution works for you!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 02:59 AM - edited 09-23-2024 04:49 AM
Hi Abhijit Das7,
For this usecase go to the default value of the variable and use this piece of code - "javascript: gs.getUserID()" and your goal will be achieved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 03:25 AM - edited 09-23-2024 03:30 AM
Hello @Abhijit Das7 ,
Please set the Default Value of that requester variable : javascript:gs.getUserID() //name of logged in user
or other you can use the onload catalog client script:
script:
function onLoad() {
var currentUser = g_user.userID;
if (g_form.isNewRecord()) {
g_form.setValue('preparer', currentUser);
}
}
If my answer is helpful please mark it as helpful or correct!!