updating catalog variable with field value

SabiraP
Kilo Explorer

can i get RITM field's value of one catalog into an other catalog item's referenced type variable in flow designer without script

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@SabiraP 

your requirement is not clear.

You have Catalog Item A and another Catalog Item B which has a reference variable in it.

what next? share screenshots

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

kaushal_snow
Giga Sage

@SabiraP ,

 

As per my understanding of your requirement, it's not possible, because the only way to get variables from a requested item in a flow is to use the Get Catalog Variables action after you’ve looked up the RITM and then use those value in subsequent actions, but there’s no built in flow action that will automatically update or insert a variable on a different catalog item without either scripting or a custom action around the variable tables....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant - Rising Star/Class of Legends 2025

Brad Bowman
Kilo Patron
Kilo Patron

You can't update ANY Catalog Item variables with ANY value in Flow Designer without a script - as easy as this was in Workflow Editor.  I have created a custom Action that is dynamic, so I can pass in the RITM (trigger from the flow), Variable Name, and Variable Value, and the action script will do the update.  In your case since you want to get the value from a different RITM record you would first do a Look Up Record activity to return that RITM, then pass in to the custom action as the variable value the field data pill from that look up activity, or the variable pill after a Get Catalog Variables action on the Look up record, if you meant a variable from the other RITM, not a field.

 

In case it's helpful, here's what my custom action looks like

BradBowman_0-1765896059889.png

BradBowman_1-1765896089774.png

(function execute(inputs, outputs) {
  try { 
    var variables = inputs.ritm.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.ritm.update();
    outputs.state = 'success';
  }
  catch (e) {
    gs.error(e);
    outputs.state = 'error';
  }
})(inputs, outputs);