How can I populate current catalog item name inside a variable of same catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 02:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 02:43 AM
use code - javascript:current.cat_item in default value of name field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 02:46 AM
Write an on load client script:
function onLoad() {
//Type appropriate comment here, and begin script below
var item = g_form.getParameter("sysparm_id");
g_form.setValue('your variable name goes here',item);
}
In place of bold text write the variable name of 'Name' variable.
Thanks,
Mihir

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 02:47 AM
Hi Shrija,
Since Name field is a reference you can assign the SYS_id of the current item by using the below script in an onload catalog client script
var sysId = gel('sysparm_id').value;
Then set this value to your name field.
g_form.setValue('fieldname',sysId);
Or
with g_form.getParameter('sysparm_id') in a client script you can get the sys_id of the catalog item
Or
var Sysid = g_form.getUniqueValue();
Refer the links below for details:
Dot walking in client script for catalog item
Unique Record Identifier - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2019 06:03 PM
I know this is an old post but I run into the same issue today and resolved it successfully by creating a workflow run script and put current.cat_item.sys_name. I hope this will save some time.