create or update record in multi row question answer for MRVS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2020 08:19 AM
Hi Everyone,
In HR module, we have a resubmit the function of the case, the form includes multi-row variable set, after the business scenario is when the case was reject, the user can go to the portal page to modify the contents of the case.
However, the problem i encounter now is how do i deal with the data in the background if the user adds or removes a row of multi-row. I know their corresponding content is stored in multi row question answer, and how to modify or create the corresponding value in multi row question answers after getting the new multi rows on the form, but now i have no idea, can someone give me some advice? Many thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2020 01:28 AM
Hi,
The above script can be used from Client Side to add/remove rows. If it is from Server side, you can write something like this.
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', <sysid of your ritm>);
gr.query();
if(gr.next()){
var mrvs = gr.variables.<your mrvs var name>
var newRow = mrvs.addRow();
newRow.setCellValue('variable1',"qwerqwer"); //Your variable within MRVS
newRow.setCellValue('variable2',"qwertqwer"); //Your variable within MRVS
gr.update();
}
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', <sysid of your ritm>);
gr.query();
if(gr.next()){
var mrvs = gr.variables.<your mrvs var name>
mrvs[1].deleteRow(); //If you know the row number then. If you don't know Loop through
gr.update();
}
Note: Give your HR Case table instead of sc_req_item.
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2020 03:22 AM
Hi,
I try this method, but it not work.
var gr = new GlideRecord("sn_hr_core_case");
if(gr.get("e1fe8d98db516010e0d90e1dd396195d")){
var mrvs = gr.variables.business_card_information;
mrvs[0].deleteRow();
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2020 04:07 AM
Now, you have both Server side code & Client Side Code to deal with MRVS.
When you are working with Record Producer, You need to transfer the MRVS values while submitting the form so that it can stay in your Table Record i.e.
sn_hr_core_case
Are you saving the Variable Set values while submitting the Record Producer for the first time? If so,
I think you need to first write an OnLoad script by passing sysid of that hrcase record and get the variable set values when the user ReOpen
then you can use my first code which I posted and can deal with that.
Thanks,
Narsing