- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 06:09 AM
How to write script to get current logged in user's name into description of catalog
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:12 AM
Hi @Obito
You need to write client Script(onload) on the sc_cat_item table and below is the script:
function onLoad() {
// Specify the sys_id of the catalog item to check
var targetSysId = 'c112f7fcc30e8210d30c564ed4013101';
var currentSysId = g_form.getUniqueValue();
if (currentSysId === targetSysId) {
var userName = g_user.getFullName();
g_form.setValue('description',userName);
}
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:08 AM - edited 05-30-2024 07:30 AM
Hi @Obito ,
What is your use case?
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:12 AM
Below is my actual usecase
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:12 AM
Hi @Obito
You need to write client Script(onload) on the sc_cat_item table and below is the script:
function onLoad() {
// Specify the sys_id of the catalog item to check
var targetSysId = 'c112f7fcc30e8210d30c564ed4013101';
var currentSysId = g_form.getUniqueValue();
if (currentSysId === targetSysId) {
var userName = g_user.getFullName();
g_form.setValue('description',userName);
}
}
Thanks and Regards
Sai Venkatesh