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
Shivani ThaparShivani Thapar 

Deploy from sandbox

Hi all, 

How do I deploy a apex class from sandbox to production so I can use it in a visual force email? 

Thanks,
JayOlayJayOlay
Hi Matt -- You should use the change set functionality described here: https://help.salesforce.com/HTViewHelpDoc?id=changesets.htm&language=en_US
  1. Include the apex class in the sandbox in an Outbound Change Set
  2. "Send" it to the Production environment (you may need to enable the Production org to receive change sets)
  3. Once it's received, deploy it on the Production environment
Additionally, you'll have to make sure your class has 75% test coverage!
Shivani ThaparShivani Thapar
ok thanks - how do I ensure its tested before deployment? 

Also I took a look at doing an outbound change sets, but I dont have the ability to choose "deployment connections" on my enterprise version of salesforce... 

Thoughts? thx
JayOlayJayOlay
The testing piece is described in the following document, and is required for successful deployment: https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

Only users with the "Deploy Change Sets" permission will be able to choose deployment connections (https://help.salesforce.com/HTViewHelpDoc?id=changesets_about_connection.htm&language=en_US). Please double check this.
Robert ZentgrafRobert Zentgraf
Hi Matt,
you should write a apex test-class for test coverage (beginning with isTest in apex class).
Additional, please check whether there is a connection between prod and dev-environment.

Regards
Robert
(mindforce: mind-force.de)