You need to sign in to do that
Don't have an account?
mahender
How to Clone the latest record??????
Hi,
i have one object that is Order. i want to clone the latest record from this object for this
i need to select latest record and the record should ber clone..
So, would you tell "how to select the latest order and how to wite the code for Clone button that should be clone recently created order only "
Here i want to create the Clone button not for the particuler record in the view page in that page all record list page.i think you can understand.
would any one help
thanks in Advance.....
Hi,
You can try below code
List<lead> l = [select id, firstname, lastname, company from lead ORDER BY Lastmodifieddate DESC];
if(l.size()>0)
{
lead l2 = l[0].clone(false, true);
insert l2;
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi Navatar
how r u???
thank you for your good ans but Navatar at the samwe time the order items also add to that clone page.
i will in deatail
i have two objects one is Order and second one is Order_Items.there is lookup relationship now my problem is colne the order and orderitems after clicking Clone Order custom button.