how to change a field value(variable) if the ritm is approved
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 04:42 AM
I have a requirement that when a requested item is approved, I have to change the value of a variable as approved and at the same time store that date in another variable , how can we do that using flow, or is there any more feasible way to do that
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2025 01:03 PM
I have a custom action that sets a catalog variable. I pass it the RITM record, variable name and variable value, and it sets the variable to the given value. Here's what it looks like:
Inputs:
Script step:
Script from script step:
(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);
Action Output: