- 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 01:06 AM
I use a slightly different version of the insert UI Action that is out of the box, just to create a record with a different number of ID
UI Action
Insert
Action Name: sysverb_insert
Script:
if (typeof current.number != 'undefined' && current.number) {
current.number = ""; // generate a new number
}
answer = current.insert();
- 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 01:14 AM
Thank you mguy and Harikrishnan for your quick answer, it's perfect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 01:42 AM
I've a little error cause maybe by the id, even if i put an other current.number...
function duplicateAndConvert()
{
current.insert();
action.setRedirectURL(current);
}