How to add action Clone/Copy button for Variable Set

Nirmala B
Giga Contributor

Kindly help in how to add Clone or Copy action button for Variable Set in Record Producer.

I need to copy the records or values of one row of variable set and create a new row entry in same variable set. this action must happen before submission of main record producer.

Thanks in advance

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nirmala,

you will have to use some custom code to copy; or else what you can do is use onSubmit catalog client script and set the mrvs value as below

One more option is to have a macro variable and have button name as Copy; on click of it get the value; and copy

function onSubmit(){

var value = g_form.getValue('mrvs_variable');

var parser = JSON.parse(JSON.stringify(value));

var obj = parser[0];

arr.push(obj);

g_form.setValue("mrvs_variable",JSON.stringify(arr));

}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

6 REPLIES 6

Thank you Ankur. I will try with this solution.

RK29
Tera Contributor

Hello Nirmala, 

 

Are you able to implement a third 'Copy' button?