- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2020 08:59 PM
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
Solved! Go to Solution.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2020 09:34 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2020 09:21 PM
Hello Nirmala,
Please refer below link,
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/copy-ui-action-change-requests/
Just make a change with table name.
Hope this will help you to resolve your query.
Kindly mark the answer correct and helpful if it will resolved your query.
Regards,
Akshata
(ServiceNow Developer).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2020 09:34 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2020 06:51 AM
Hi Ankur,
Thank you for reply. I need a checkbox to be added to variable set so that I can copy that specific record only. I have tried your code that is working fine but its creating duplicate of all the rows which are in variable set. I need for selected rows only.
Is it possible to add checkbox and get id of that selected row in variable set.
Kindly help if you have solution. Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2020 07:44 AM
Hi Nirmala,
So you are saying one more checkbox variable you want to create which says whether to copy or not
please check below links:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader