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
lilian.moncadelilian.moncade 

Custom layout for custom clone button.

Hello,

I explain my problem.

 

I need to clone a record, with a multi-step for the record creation.

My multi step is already working correctly. ( with multiples VF pages )

I create a copy of clone button using : 

<apex:commandButton action="{!URLFOR($Action.Operation__c.Clone,Operation__c.id)}" value="Renouvellement" rendered="{!isRenouvellement}"/>

 

But when I override the clone button, in the configuration of this object, the redirection is set correctly to my custom layout, but it is not a clone of my object. When I save, it updates my record, instead of creating a new.

 

I guess i missed something , but i don't know what.

I wanted to use parameters, but param does not work correctly with buttons.

Any help would be appreciated.

 

Thx

 

 

AdrianCCAdrianCC

Hi,

 

With what action exactly have you overidden the clone button? Does that action(button, link etc) provide a way to copy over the Operation__c(clone it)? I think that's where your problem is.

 

Can you post here the code please?

 

Thank you,

Adrian

lilian.moncadelilian.moncade

I overriden the clone action with the same VF page than the button New for the same object. Doint that, i have the same multi step record creation, but saving make me update the cloned record instead of inserting a new.

 

But, i resolved this yesterday.

I don't know if it's the best way but it works correctly.

 

I changed the value of the "action' parameter in my button.

I created a new method in my controller, and in this method i begin with : operation = operation.clone().

Then i return a PageReference which is the step 1 page and my formulary continues with step2 etc ...

 

Thx you for answering. I can't post here my code because i changed it.

 

Have a nice day.

 

 

 

AdrianCCAdrianCC

Cool! Way to go :)