- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 02:17 PM
I have a two stage Order Guide Sequence configured. The first stage involves a request for a security review and the second stage has a request item that has a reference field to select a completed security review request item.
I have two steps in the second stage, one is for the request item I need to update, I have that set to end without waiting for completion (I can't reference the output from this step unless the action runs after it). Then the second step triggers an action to update a variable in a request item. This action shows it's running successfully, but I cannot get it to actually update the reference field.
These are the inputs/script for the action step, I can test this against one of the request items and it works:
(function execute(inputs, outputs) {
try {
var variables = inputs.requested_item.variables.getElements();
for (var i = 0; i < variables.length; i++) {
var question = variables[i].getQuestion();
if (question.getName() == inputs.variable_name) {
question.setValue(inputs.variable_value);
}
}
inputs.requested_item.update();
outputs.state = 'success';
}
catch (e) {
gs.error(e);
outputs.state = 'error';
}
})(inputs, outputs);
I think the issue I'm running into is the Request Item input from the playbook screen, the step for the order item only outputs the "Record ID":
But I think I need the sys_id for the input of the action, right? I can't figure out how to get this to work and I'm wondering if there's something simple I'm missing. The crazy part is the "Record Id" output from the order item steps looks like a sys_id, and if I choose the sys_id output from the pill selector it throws an error on the playbook because it's not available.
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2025 11:17 AM
I figured it out, ultimately the script I had set up wasn't working despite tests working successfully.
I wrote an action to update variables using OOB look up/update record actions based on this post (similar to what Sebastion outlined):
Solved: Setting, or updating variables in flow designer - ServiceNow Community
I don't know if it's needed but currently I have a "lookup record" action after each order guide step to lookup the actual record reference, and then I pass that into my action to update the reference variable and it's working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2025 12:10 AM
Hey
Maybe I overlook something. But why do you not just do a simple look up record within a flow for the other requested item.
In my understanding a solution could be:
1. Create a flow variable within the second request (Name could be: security review request item)
2. First action in the flow is a look up on the requested_item table parent=request, and state=complete
3. Set flow variable value with found record of step 2
4. Use the action "Create catalog task" to display the flow variable within the task
I know this would not display the variable within the requested item, but it would give you the possibility to display the task to the user and to use it in our flow. In case the flow is also used outside of an order guide, you would need to include an error handling, when the look up fails.
I hope the answer helps you.
Kind regards
Sebastian
PS: I do not know, if you script works successfully. I never scripted to get variable values. I always use the action "Get Catalog Variables" that is available OOTB. If you need to write a variable value, i always do this two actions within a flow:
1. Look up Variable ownership
2. Update option record (Attention: Dot-walk to the table)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2025 07:47 AM
I'm not sure I'm following your logic. The order guide I'm trying to configure is attempting to take 3 separate requests that were traditionally manually requested independently of each other and package them into a single request:
(stage 1)
1. Create thing
2. Get required security approval to make that thing accessible publicly
(stage 2)
3. Configure the thing to be publicly accessible
Right now people submit #2, then they submit #3 and we require the reference to #2 as validation it's approved.
It seems like you're describing modifying #3 to be both the approval and configuration, and I originally tried to do that by making #3 also submit the security request but then the request would show up for approval without any variables listed which won't fly. It seems to me there should be a simple way to reference other request items that are part of the same order guide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2025 10:48 AM
Also, for what it's worth, I found the post where that script came from:
Set Value of a Catalog Variable at Flow Designer - ServiceNow Community
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2025 11:17 AM
I figured it out, ultimately the script I had set up wasn't working despite tests working successfully.
I wrote an action to update variables using OOB look up/update record actions based on this post (similar to what Sebastion outlined):
Solved: Setting, or updating variables in flow designer - ServiceNow Community
I don't know if it's needed but currently I have a "lookup record" action after each order guide step to lookup the actual record reference, and then I pass that into my action to update the reference variable and it's working.