function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MikeGillMikeGill 

Mimic the standard clone button with a onclick javascript custom button

Is this possible

 

Mimic the standard clone button with a onclick javascript custom button 

 

I know I can do with with controller extension, but trying to avoid having to create the page using visualforce e.t.c

 

Thanks

goabhigogoabhigo

Yes it is possible. I have tried it in the past but code is not in java script though.

 

<apex:commandButton value="Clone" action="{!URLFOR($Action.Opportunity.edit, opportunity.id, [clone='1'])}"/>

 

Replace Opportunity with your object's API name.

 

Found this code suggested by someone when I searched for something similar - clone without using controller.

MikeGillMikeGill

Thanks for the response - I can run this without visualforce though?

goabhigogoabhigo

Sorry I didn't read your post correctly. This code works on VF page :(

Teach_me_howTeach_me_how

adding custom button in a standard page there is a option that it can return url after click right?

MikeGillMikeGill

Yes there is a way to redirect to a url. Actually that's a good point. I can create varibles of all the existing values I want in the new rrecord, then redirect and set...

 

Thanks all - I think I know how to do it now. 

Teach_me_howTeach_me_how

hi mike..  i hope you post it here your solution might be helpful to us someday thanks