+ Start a Discussion
Rocks_SFDCRocks_SFDC 

How to append the text to Name field of custom object on Clone by using visualforce pages.

Hi Team,

We want to append "some text" lets say "Copy" to the Name field of a custom object when we click on "Clone" button.

Do we have any workaround for this.

If any one post sample code, then that could be great helpful.

Thanks,
Anil
Abhishek BansalAbhishek Bansal
Hi Anil,

Please follow the below steps to set a default value on Name field of Custom object when Standard Clone button is clicked on any record :
  1. Create a VF page with below code :
  2. <apex:page standardController="Campsite__c" action="{!URLFOR($Action.Campsite__c.New, null, ['Name'='TestAccount'], true)}">
    </apex:page>
    //Replace Campsite__c with API name of your custom object.
     2. Now Overiride the standard Clone Button of your custom object with this VF page.

In this way you can populate name field on click of clone.

Let me know if you need more help on this.

Thanks,
Abhishek
Rocks_SFDCRocks_SFDC
Hi Abhishek,

Thank you for the reply.

when we click on standard clone button, we want to append the "Copy" to the Name field. we dont want to set default value on the Name field this time. And also this needs to happened when some other field(Ex: Catagory__c) is blank on the same object.

Thanks in Advance,
Anil