- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 12:54 AM
Hello everyone,
Is it a way for duplicate a record easily ?
I means without copying each field ?
Actually I use this method
current.start_date = 'NULL'; current.end_date = 'NULL'; current.calendar_duration = 'NULL'; current.opened_at = current.opened_at; current.opened_by = current.opened_by; current.sys_created_on = current.sys_created_on; current.sys_created_by = current.sys_created_by; current.insert();
But my record have a lot of field, and It can be very long...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 01:07 AM
Hi Romain,
if you simply put current.insert(), it will insert a duplicate of the current record in your table. So incase you need to set certain values for this new record like:-
current.description="Duplicate record";
current.short_description="Duplicate";
you can set those values and then use current.insert().
Thanks & Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 02:05 AM
can you share the rest of the code if possible pls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 02:07 AM
You've the entire piece of code.
But it seems to be cause by an other thing because now my ui action is not active
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 02:15 AM
ok fine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2014 01:18 AM
make sure there aren't any actions with duplicate action_name in that table....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2014 06:43 PM
Create a new System UI Action
doInsertAndStayRequest();
function doInsertAndStayRequest() {
var saveMe = current;
var orig_sys_id = current.getValue('sys_id');
var orig_number = current.getValue('number');
current.number = ""; // generate a new number
current.state = 1;
current.insert();
gs.eventQueue("task.insert", current, orig_sys_id, current.sys_id);
current.work_notes = "Cloned from Ticket: " + orig_number;
gs.addInfoMessage("Cloned from Ticket: " + orig_number);
Packages.com.glide.ui.SysAttachment.copy(current.getTableName(), orig_sys_id, current.getTableName(), current.sys_id);
current.update();
action.setRedirectURL(saveMe);
}