How to Create a Second RITM Under the Same REQ After 14-Day Delay in Flow Designer?

LokeshwarRV
Tera Contributor

Hi Community,

I have a requirement in ServiceNow where:

  • A user submits Catalog Item A.
  • A Flow Designer flow runs for Item A.
  • After 14 days, I need to automatically submit Catalog Item B.
  • Both items should belong to the same Request (REQ), so the final result is one REQ with two RITMs (Item A and Item B).

I know the Submit Catalog Item action in Flow Designer creates a new REQ by default. Is there an out-of-box way to attach Item B to the existing REQ? Or do I need a custom solution?

If custom scripting is required:

  • How do I create a new sc_req_item under the same REQ?
  • How do I populate variables for Item B and trigger its workflow/flow?

Any best practices or sample code would be greatly appreciated!

Thanks in advance.

5 REPLIES 5

VaishnaviK43271
Tera Contributor

Hi @LokeshwarRV !!

 

ServiceNow Flow Designer does not provide an out-of-the-box option to submit a catalog item and attach it to an existing Request (REQ). By default, the “Submit Catalog Item” action creates a new REQ. So in your case, custom logic is required to attach Catalog Item B to the same REQ as Item A.

 

Custom Solution Approach

You can achieve this by creating a new sc_req_item (RITM) record under the existing REQ and populating its variables. Here’s the general approach:

  1. Retrieve the existing REQ

    • You’ll typically have the current RITM (Item A) or REQ record available in your flow.

    • Example:

var reqSysId = current.request; // sys_id of REQ from Item A
  • Create a new RITM (sc_req_item) under the same REQ

     
var newRitm = new GlideRecord('sc_req_item');
newRitm.initialize();
newRitm.request = reqSysId; // Link to existing REQ
newRitm.cat_item = '<sys_id_of_Item_B>'; // Sys ID of Catalog Item B
newRitm.short_description = 'Automatically submitted Item B';
// Set other fields if needed, e.g., assigned_to, priority
var ritmSysId = newRitm.insert();
  • Populate variables for Catalog Item B

    • Variables are stored in sc_item_option table.

     
var vars = {
    'variable_name_1': 'value1',
    'variable_name_2': 'value2'
};

for (var v in vars) {
    var sci = new GlideRecord('sc_item_option');
    sci.initialize();
    sci.request_item = ritmSysId;
    sci.item_option_new = getVariableSysId('<variable_name>', '<cat_item_sys_id>');
    sci.value = vars[v];
    sci.insert();
}
  • getVariableSysId() is a helper function to retrieve the sys_id of the variable from item_option_new.

  • Trigger workflow/flow for the new RITM

    • Standard way is to call:

     
var wf = new Workflow();
wf.startFlow('<workflow_sys_id>', newRitm, 'update');
  • Or, if you have a Flow Designer flow triggered on sc_req_item insert, it will trigger automatically once the RITM is inserted.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for.

Thank You