Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Simple way for duplicate a record

xif1
Mega Expert

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...

1 ACCEPTED SOLUTION

harikrish_v
Mega Guru

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


View solution in original post

11 REPLIES 11

Cool, Thanks!

Nirmala B
Giga Contributor

Is there anyway without out inserting data to system, can we show the duplicate records in open form.

Kindly help.