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
JuulJuul 

Clone object (contract object)

Hi,

 

Due to security issues we need to rebuild the contract object in a new custom object.

Is there a posibility to clone the contract object (with all the fields 100+) and records to a new custom object?

 

thanks

 

juul

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

Follow bellow steps,

 

1) Load your code in Force.com IDE (Eclipse)

2) Now expand src -> objects

3) Find object Contract

4) Copy entire file

5) Now right click on objects node in treeview and click on new -> object

6) Give any name you want.

7) Click on Save - It will create new object in Salesforce.com server also.

8) Now paste code which you have copied from Contract object file and change name for object (last in file)

9) Now you have to add '__c' for standard fields which was in contract object (i.e. description, status etc.) and add label for that.

10) Save file locally and now deploy this file to server.

All Answers

Dhaval PanchalDhaval Panchal
Yes, you can do following things.

Create one custom object with same fields as in contract object. Then fetch all records in csv file using data loader. Then import same csv file using data loader to new custom object by mapping with new fields.
JuulJuul

Thanks dapanchal,

 

That was my first thought but I'm not in the mood to create more than 100 fields (including the translation). So I'm wondering is it possible to clone the full object (with the 100+ fields) and rename it to f.e. Contractregister and then I can use the dataloader to upload all the records.

 

Dhaval PanchalDhaval Panchal
Yes, You can use migration tool for that, or eclipse Ide.
JuulJuul

ok..... but how? 

Dhaval PanchalDhaval Panchal

Follow bellow steps,

 

1) Load your code in Force.com IDE (Eclipse)

2) Now expand src -> objects

3) Find object Contract

4) Copy entire file

5) Now right click on objects node in treeview and click on new -> object

6) Give any name you want.

7) Click on Save - It will create new object in Salesforce.com server also.

8) Now paste code which you have copied from Contract object file and change name for object (last in file)

9) Now you have to add '__c' for standard fields which was in contract object (i.e. description, status etc.) and add label for that.

10) Save file locally and now deploy this file to server.

This was selected as the best answer
Dhaval PanchalDhaval Panchal

Refer below sample how to change fields (only for contract standard field, for contract custom field you no need to do any change)

 

consider below lines.

    <fields>
        <fullName>AccountId</fullName>
        <type>Lookup</type>
    </fields>
    <fields>
        <fullName>ActivatedById</fullName>
        <type>Lookup</type>
    </fields>
    <fields>
        <fullName>CompanySignedId</fullName>
        <type>Lookup</type>
    </fields>
    <fields>
        <fullName>CustomerSignedId</fullName>
        <type>Lookup</type>
    </fields>
    <fields>
        <fullName>OwnerId</fullName>
        <type>Lookup</type>
    </fields>

 Now see below changes in above lines (in red color)

 

    <fields>
        <fullName>Account__c</fullName>
        <type>Lookup</type>
        <label>Account</label> </fields> <fields> <fullName>ActivatedBy__c</fullName> <type>Lookup</type>
<label>ActivatedBy</label>
</fields>

follow same thing for all other contract standard fields.

Dhaval PanchalDhaval Panchal
Let me know if you have any question on this.
JuulJuul

Thanks!!

LejlaLejla

Hi, 

 

Thaks for the tips on how to do this, would you be able to tell me how the last step works and how I should deploy the new object?

 

When trying to save i get an error: ContractCustom__c: Must specify a non empty label for the CustomObject

 

Kind regards,

Lejla