Duplicating Data in Multi Row Variable Set

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 09:43 AM
On one of my catalog Item's Item View screen, if we select the number of Servers it automatically adds the same number of rows in MRVS with some default values.
Now the requirement:
Suppose user select 5 Servers, MRVS is updated with 5 rows with some default values.
User modifies the data in first row of MRVS, it should always replicate the data of few variables in the rest of the four rows?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 11:26 AM
Multi row variable sets store the data as stringified array of objects, so if you want to 'set' the mrvs to have x rows when the number is changed you could just have a onchange client script do something like;
function onChange(...){
// oldvalue!=newvalue bit
// lets assume your mrvs has 3 variables in it, name, ip, and fqdn
var emptyRow = {name: "example name", ip: "1.1.1.1", fqdn: "example.acme.com"};
// now lets build that array;
var returnArray = [];
var numberOfServers = parseInt(newValue,10);
for(var x = 0;x<numberOfServers;x++){
returnArray.push(emptyRow)
}
returnArray = JSON.stringify(returnArray);
g_form.setValue('yourMRVSnameHere', returnArray);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 12:03 PM
It is not on the change of any variable on the Item view form but when value is changed on the modal form of multi row variable set

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 12:33 PM
Its not going to be easily possible. Looks like this gets close but has no way to set the whole MRVS