How to access catalog item sys_id in multi row variable set (MRV) catalog client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2020 08:41 AM
How to access catalog item sys_id in multi row variable set (MRV) catalog client script?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2020 09:09 AM
Is this being used in the Service Portal, or in the UI?
If this is being used in the UI, then you can use a line like this in a script (onload or onchange in the variable set):
var cat_id = window.parent.g_form.getUniqueValue();
In the Service Portal, you can do this with some extra setup.
In an onload script, do the following: note the placement of the variable outside of the onload function:
function onLoad() {
//Type appropriate comment here, and begin script below
}
cat_id = g_form.getUniqueValue();
Then, inside a script in your variable set, you can just call cat_id to get the value: alert(cat_id); for example.
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2020 03:12 AM
This is on native UI and I tried your solution but end up with below error from MRV client script:
"TypeError: Cannot read property 'parent'"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2020 04:12 AM
Finally, it worked when strict javascript mode was disabled from catalog client script ("Isolate script = false")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2020 09:10 AM
Another option would be something like this.
var gUrl = new GlideURL();
gUrl.setFromCurrent();
var id = gUrl.getParam("sysparm_id");
alert('ID: ' + id);