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
HL-DevHL-Dev 

Apex trigger Pre-Deployment questions

Hi everyone,
I'm fairly new at developing on this platform and have a few pre-deployment questions. I've written a trigger that executes after a certain event happens. Also, I wrote a testMethod for the previous trigger, and the test log shows no issues so far. Now, I've done all this on sandbox.
- When I'm ready to push this into production, would I first create a new project by synching the production box's metadata? Because sandbox's metadata isn't the same as production's.
- What happens if after the trigger is deployed on production, I decide to modify/remove it? Is it possible to remove a previous trigger by using the Force.com toolkit for Eclipse? Or is it only possible via the Ant tool?
Thanks in advance.
HL-DevHL-Dev
Ok, I tried to deploy the new trigger into production, and I'm getting an error. This are the steps I'm taking:
1. As I mentioned in my previous post, I have a trigger that executes a method within an Apex class running in Sandbox. So essentially, I have two Apex classes (the original class and the test class) and one trigger. I ran the testMethod on Sandbox just fine and have no issues there.
2. I right clicked on this project (created according to the metadata of Sandbox) and selected Deploy to Server.
3. For Step 1, I selected the production instance to be the SOAP EndPoint. And then setup the proxy configuration section.
4. For Step 2, I selected the destination and project directories where the zip files will be stored. 
5. Everything is fine until I get to setp 3 (Deployment Plan). On this page, all the S-Controls, Apex classes and triggers that I've created on Sandbox are auto-selected. I then de-select all and only select the 2 Apex classes and the one trigger to be deploy to production.
5. When I click on Validate Deployment, I get this error:
 
"Invalid Package version: 12.0"
 
 I understand this, we're running API version 12.0 on Sandbox, but only 11.1 on production. I didn't think that simply changing the package.xml to point to version 11.1 was going to solve the issue, but I tried anyways. Now, I get this error instead:
 
 unpackaged/triggers/updateTaskTrigger.trigger-meta.xml
 Problem: Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}active invalid at this location
 
If I check the trigger-meta.xml file, there's an "active" element set to true. This makes sense, since I created this project from Sandbox.
 
Does anyone have any insight on the issue I'm having? And sorry for the long post.