Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Add an "Add and Stay" button to an MRVS modal

NeoOndaro
Tera Contributor

Hi Everyone,

Had anyone tried or know how to modify the MRVS to add an "Add and Stay" button on the Modal popup? Users have to enter many records it's a lot of clicks to click 'Add', then click Add again just to re-open the modal. We'd like to keep the modal open until they are done entering rows. We'd like to just add a "add and stay" button next to the Add button on the modal. We accomplished this in a different way using DOM , but we want to try and eliminate all DOM so trying to find a new way to accomplish it.

AI says "Clone and edit the sc-multi-row-variable-set widget". But that widget doesn't exist. the "Table Variable Active Row" exists, (sp_config?id=widget_editor&sys_id=48335f2973130300f49d0690fdf6a7d4&spa=1) but I dont think that's it.

Thoughts?

1 ACCEPTED SOLUTION

pr8172510
Giga Guru

Hi @NeoOndaro,

I tried multiple approaches in my PDI for this requirement, including:

  • Client Scripts (onLoad / onChange / onSubmit)
  • MRVS value trigger logic
  • Attempting DOM-based handling (even via iframe access)

But none of these worked reliably.

The reason is that MRVS modal is rendered using internal Angular components, and the Add button event is not exposed to client scripts. Also, with script isolation and platform restrictions, DOM-based approaches are not stable or supported.

So currently:

 There is no OOTB supported way to add an “Add and Stay” button in MRVS modal
 Cloning/editing widgets like Table Variable Active Row also doesn’t help for this use case


Recommended approach

The only reliable way is:

 Build a custom solution

  • UI Builder (recommended)
  • Service Portal custom widget
  • UI Page (classic)

This way you can fully control:

  • Modal behavior
  • Buttons (Add / Add & Stay)
  • Data handling

View solution in original post

5 REPLIES 5

pr8172510
Giga Guru

Hi @NeoOndaro,

I tried multiple approaches in my PDI for this requirement, including:

  • Client Scripts (onLoad / onChange / onSubmit)
  • MRVS value trigger logic
  • Attempting DOM-based handling (even via iframe access)

But none of these worked reliably.

The reason is that MRVS modal is rendered using internal Angular components, and the Add button event is not exposed to client scripts. Also, with script isolation and platform restrictions, DOM-based approaches are not stable or supported.

So currently:

 There is no OOTB supported way to add an “Add and Stay” button in MRVS modal
 Cloning/editing widgets like Table Variable Active Row also doesn’t help for this use case


Recommended approach

The only reliable way is:

 Build a custom solution

  • UI Builder (recommended)
  • Service Portal custom widget
  • UI Page (classic)

This way you can fully control:

  • Modal behavior
  • Buttons (Add / Add & Stay)
  • Data handling

This confirms what I suspected. Cheers.

NeoOndaro
Tera Contributor

Looks like a feature request is in order.

Ankur Bawiskar
Tera Patron

@NeoOndaro 

I will recommend to avoid this much heavy customization as it increases technical debt

instead ask user to fill in template and upload file in attachment type variable and load data into MRVS rows

Populate MRV in a record producer with data by an imported excel 

Attach csv to catalog item to populate a Multi Row Variable Set (MRVs) 

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader