Multi row variable set default values based on previous row values
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:00 PM
Hi there,
I have requirements to default some of the fields on a MRVS based on previously entered row i.e. when the user clicks the Add button, I should be able to access the Multi Row Variable set and find the last row and then set the pop up windows with new values. I have added a new On Load client script to the Multi Row Variable Set and trying to get the value it always returns empty.
var delegationMvrJson = g_form.getValue("delegation"); // the name of the MRVS is delegation
alert(delegationMvrJson);
How can I access the values of the MRVS in the Load Script? Or what are the other options?
Many thanks
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 11:16 AM
Your onLoad script in the MRVS should look like this:
function onLoad() {
var mrvs = g_service_catalog.parent.getValue('delegation'); //internal name of MRVS
if(mrvs.length > 2){ //native UI returns [] for empty MRVS value which causes a parsing error
var obj = JSON.parse(mrvs);
g_form.setValue('v_var_1', obj[0].v_var_1) ;//name of the MRVS variables to autopopulate from and to
}
}