Delete rows from MRVS in workflow

Ruchi Kumari1
Tera Expert

Hi,
Is there any direct method to delete MRVS rows in server side script like what we have similar to addRow() ? Or i need to gliderecord 'sc_multi_row_question_answer' table and delete records there ?
The resources available in community mentions about removing values in client scripts. However, I am looking for a solution to remove rows in workflow script (on RITM).

11 REPLIES 11

GlideFather
Tera Patron

Hi @Ruchi Kumari1,

will the rows be erased always or only sometimes??

Why don't you change the configuration of record producer/catalog item not to ever create the rows... or I don't understand it, please give me more context of the whole scenario.

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Ankur Bawiskar
Tera Patron
Tera Patron

@Ruchi Kumari1 

you want to delete only 1 row from that MRVS rows?
If you know something is unique in that row and you know which one to delete, you can easily play with the JSON manipulation and set the MRVS variable again in server side.

Another way is to delete record from sc_multi_row_question_answer table

what's your actual requirement? share that and share what you want to delete

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Swapna Abburi
Mega Sage
Mega Sage

Hi @Ruchi Kumari1 

You can use JSON.parse method to parse the multi row variable set object. Post that, you need to reconstruct the JSON by removing the rows that you want to delete from MRVS.

 

Set MRVS variable with newly formed JSON object. Please share the criteria to be used in script to remove the rows.

Ruchi Kumari1
Tera Expert

@Ankur Bawiskar @GlideFather ,
The actual requirement is as below:
I have a catalog which has list collector type of field allowing to select multiple users. There's a MRVS which displays assets belonging to each user. This MRVS get auto updated based on users added/removed. 
Once catalog is submitted, multiple RITMS are created, each belonging to individual users selected.
There is one parent RITM and script generated RITMs(based on users selected).
On script generated RITMs i am able to display only those assets which belongs to requested for of the RITM.
However, the parent RITM displays all the assets it was on form. 
So i am trying to update this parent RITM's MRVS as well by removing the assets belonging to other users .

Basically, in all the RITMs, the MRVS should display asset belonging to requested for.
Users can have multiple assets on their name. In the screenshot, user id ending with 22 has multiple asset and user id ending with 11 is requested for value in parent ritm which is generated by default..

Please refer attached snippets.
1. Catalog form display (image 1 & 2)
2. Parent RITM (image 3)

RuchiKumari1_0-1751542783111.png

RuchiKumari1_1-1751542880836.pngRuchiKumari1_2-1751542981543.png