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
saracsarac 

Custom Object (and Standard) changes NOT deploying via Eclipse

Hello,
 
I just did a lot of changes to our data model based on client feedback of their visualforce pages. This was done in the sandbox to both custom objects and standard objects. This included removing 29 fields from one custom object, drastically altering picklist values (both removing values and altering the name of existing values) among other changes.
 
When I tried to deploy these changes to production via Eclipse, the deployment payload generator identified those objects, I selected them and it said Success! However, NONE of the changes were actually propagated into production. No fields deleted, no picklist values deleted, the altered picklist values were just *duplicated* alongside the old values. Each subsequent time I ran the deployment piece it identified EVERY object as still be different from production - even though no changes had been made since the last "successful" attempt at deployment.
 
So after trying that a few times to make sure I wasn't insane I decided to create a new Force.com project in Eclipse from production and alter the meta-data files directly. Well, you can alter the files, but when you save them, they are overwritten immediately with the production versions. Picklist fields magically have all of the old values written right back into the file you just altered and saved.
 
This is a huge problem as I am trying to deploy these changes for a client's launch in 3 days, and re-doing all changes in both the sandbox and production is going to be a complete nightmare.
 
Has anyone else has this issue?
Thanks,
Sara
JonPJonP
Sara,

Custom Objects are what is known as a "composite" metadata type, meaning they are made up of a number of different sub-components, and as such do NOT represent an atomic, indivisible structure.

In practical terms, this means that a .object file is not considered to be the complete definition of an object; rather, it is considered a minimum definition.  When you save/deploy (same thing) an .object file to a Salesforce organization, the server ensures that all custom fields in the file exist in the organization, creating any that do not exist or updating any whose properties have changed.  The server does not delete a custom field simply because it's missing from an .object file, because it needs to handle extensions--cases where new custom fields are being added to a custom object that is defined elsewhere.

To delete fields from a custom object via the metadata API, use the Force.com Migration Tool and supply a destructiveChanges.xml file listing the fields to delete, or just do it directly in Setup from the browser.

Also note that if you change a field's fullName (e.g. "MyField__c") in an .object file, the server will interpret this as a new field.  The fullName attribute acts like a primary key to uniquely identify the field in the XML definition.

Finally, to understand how picklists are handled, see the Metadata API docs under Metadata Objects > CustomObject > Picklist:

"Note that picklist values cannot be deleted from a picklist that has been saved to your organization, since data rows might exist that would need to be interactively remapped."

I hope this clarifies the behaviors you're seeing.

Jon
Vijay RautVijay Raut

Hi Jon,

As you mentioned in your reply that we can delete custom fields using Force.com ANT Migration Tool and destructiveChanges.xml file. I was trying to do same, and also tried different options, but it didnt worked out for me.

Could you please post here sample destructiveChanges.xml and package.xml files.

Thanks in advance.

V.R.