- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 05:07 AM
HI,
We have a requirement on Multirow variable set, when ever user clicks on add it should copy previous row variable to new row.
Can some one suggest how to achieve this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 06:04 AM
Hi Kri,
First you'll need an onLoad Catalog Client Script running on the Catalog Item itself, not within the MRVS. Set the UI Type to All.
function onLoad() {
if (this) {//we only need to do this for Service Portal
//We need to make the g_form object for the parent item available from the MRVS window
this.cat_g_form = g_form;
}
}
Now within the MRVS we can create an onLoad Catalog Client Script within the MRVS, also with the UI Type = All.
function onLoad() {
var mrvs = '';
if (this) {//Service Portal method
mrvs = this.cat_g_form.getValue('mrvs1');//internal name of your MRVS
}
else{//native UI method
mrvs = parent.g_form.getValue('mrvs1');
}
if(mrvs.length > 2){//native UI returns [] for empty MRVS value
var obj = JSON.parse(mrvs);
g_form.setValue('test_1', obj[obj.length-1].test_1);//name of the first MRVS variable to autopopulate
g_form.setValue('test_2', obj[obj.length-1].test_2);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 05:22 AM
Hi Kri,
Are you using the native UI, Service Portal, or both? Do you want to populate only one variable, or all variables in the new row with variable(s) from the previous row? Do you want to always copy from the previous row, or always copy from the first row?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 05:30 AM
HI Brad,
using both, Native UI and service portal. all the variables to be copied to the new row, I wanted to copy values form previous row
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 05:35 AM
Hi, can you provide screenshot or more info about to help you on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2021 05:48 AM