catalog item sys id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 07:50 AM - edited ‎02-23-2024 07:51 AM
Hello developers, how to get catalog item sys id in on change client script which i need to use in script include.
I tried using : var catSysId = g_form.getParameter("sysparm_id");
but gives error
g_form.getParameter is not a function.
Any help is appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 08:05 AM
You can use the code below.
g_form.getSysId();
// Show the item sys_id as an Info Message
g_form.addInfoMessage(g_form.getSysId());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 08:18 AM
Hello @servicenow14710 ,
You can use g_form.getUniqueValue(); to get catalog item sys id.
Regards,
Rohini Sane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 08:12 AM
Use g_form.getUniqueValue(), which will return the sys_id of the catalog item.
g_form.getUniqueValue();
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 08:15 AM - edited ‎02-23-2024 09:42 AM
Hi @servicenow14710 ,
If you are trying to pass sys id from client script to script include use below code,
var catSysId = this.getParameter("sysparm_id");
If in client script if you are trying to get sysid,
var sysid = g_form.getUniqueValue();
gr.addParm("syspram", sysid);
if in client script if you are trying to get sys id of reference field then try ,
var sysid_field = g_form.getValue ('Field backend name');
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang