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
Nitesh AgarwalNitesh Agarwal 

Deploy to Production for validated change set

Dear All,

I have confusion around deployment of my validated Change set on produciton.

Background

The change set contains the existing classes, triggers, Test classes and custom objects, cusotm fileds, already on produciton. I have just changed the contents a bit on sandbox in these apex classes, triggers, and custom field, and have tested all on sandbox, created change set and uploaded it on produciton. then I have validated it there and validaiton is a success.

Confusion I have

Now, when I am about to delpoy to production org, I am thinking about the existing classess, triggers, test classes and custom fields, on the produciton org and is also a part of change set.

So When I will deploy this change set will it delete the existing ones on the production, or wil it overwirte them or will it create a new one. What will happen to the data already there in those exisitng fields.

It will be a great help if somebody can clear this confusion for me, as it is the first time I am with a change set with exisiting Apex classes and test classes, triggers and cusotm fields. Or can help me with some other means I can change the code on those classes in Production org.

Thanks
Nitesh
Ricardo_DiasRicardo_Dias
Hello Nitesh Agarwal,
 
Classes, Triggers and Test Classes
If in your change set you have Classes, Triggers and Test Classes, the code that already exist in the prodution will be overwrite (if the developerName was maintained, if you changed the developerName the Salesforce will understand that is a new element). The recommendation is to do a backup (by eclipse) of the actual versions of these codes. (https://developer.salesforce.com/page/Force.com_IDE_Installation)
 
Custom Objects and Fields
When you deploy custom objects and Fields these elements will be overwrite(if the developerName was maintained, if you changed the developerName the Salesforce will understand that is a new element). The values of the fields will be maintained if you didn´t change the field type, but if you changed it you will need to check this Salesforce's article that will explain to you what exactly changed you can do without lost values(https://help.salesforce.com/apex/HTViewHelpDoc?id=notes_on_changing_custom_field_types.htm&language=en).
 
Let me know if this answer helped you.
Greetings