Script Cannot retrieve requested item variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 10:44 AM - edited 04-02-2025 10:45 AM
I know that this makes no sense, but it's happening.
I have a catalog item with a handful of variables plus a few variable sets. In the workflow scripting I have a few lines that look like this:
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 12:41 PM
Hello @johnfeist
Try with below 👇
var ritm = new GlideRecord('sc_req_item');
if (ritm.get('<sys_id_of_ritm>')) {
var selectedValue = ritm.variables.priority;
gs.log("Fetched Select Box Value: " + selectedValue)
;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 01:43 PM
Workflows usually run as the 'system' user. When a user interacts with the RITM via an approval or update and there is a Run Script activity immediately following in the workflow, then the Run Script will likely run as that user, which doesn't sound like it should matter in this case but has caused lots of hair pulling when something works in some test cases but not others. Since you can see the variables and values on the RITM record, what happens when you try similar code in a display Business Rule? I don't think this would matter, but is there any difference on the Availability tab of these variables compared to those in other Catalog Items? Do these variables have the Global box checked or unchecked compared to others? Is this Catalog Item in a Catalog or Category that's different than all others?