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
mpoiriermpoirier 

The Chicken or the Egg

Hi !

 

I want to rename a sObject and all our custom classes, etc.

 

Is there a way to "Refactor" this in SalesForce ?

 

If I change the object name, error: "Existing references prevent save"

 

If I replace object names in classes, etc, error: "Object does not exists"

 

I am also trying to do it in Eclipse but without success...

 

Thanks !

 

Michel

MVJMVJ

Try inactivating the current code first.  Then rename your object.  Then before you activate your code make the changes that you need to the code.

 

you could also try commenting out the code.

 

Just some thoughts.

mpoiriermpoirier

"Activate code" ?

 

Good ! I will look into that.

 

Thanks !

 

 

JonPJonP

The Force.com Metadata API uses the developer name (aka "fullname" ) like a primary key to identify components.  Whenever you perform a Save operation from a Metadata API client like the Force.com IDE, the client sends your files to the server and the server performs an Upsert, either updating an existing component or inserting a new one depending on whether the names match.  This makes renaming from the client a bit of a challenge.

 

The easiest solution is just to rename your object in the Web UI under Setup, then refresh the files in your project. You'll have to manually delete the old .object file.

 

Depending on your project settings, you may also have to add the new object name to your project using the right-click > Force.com > Add/Remove Metadata Components... command.  If you have any page layouts, workflows, or other components that inherit the object name, this applies as well.

 

Jon

salesforce.com Product Manager

 

 

Message Edited by JonP on 06-22-2009 11:19 AM
infoweldernickinfoweldernick

Another option to consider is to just relabel the custom object if you don't absolutely have to change the API name.  You'll save yourself a lot of time and effort, but it depends on for what reason you need to change the name.

 

Nick