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
confus3dconfus3d 

Creating a Lead Trigger

Hi,

 

This seems a ridiculous question, however, I have Apex code to create a trigger from the force.com cookbook to prevent duplicate leads being created. 

 

So I have proceeded to setup->customise->leads->triggers but there is now 'new' button to create a trigger.

 

I am using Enterprise edition.

 

Can anyone help?

 

Thanks Alex.

 

 

jkucerajkucera

I've been there before :)  You can't write triggers in a production org.  You can only write triggers in one of:

 - Sandbox org (if you have one)

 - Developer Org (free at this link)

 - Eclipse software development environment (more complex way to code)

 

I recommend the developer org as it's easy.  Note to deploy (to give the code to your production org), you need tests, and you need to either package up the code or use Eclipse.

confus3dconfus3d

Hi, thats very helpful thank you.

 

I have created the trigger in a sandbox org, also in the developer edition.  How do I package up the code to send to my production environment - I cant find any literature on doing this?

 

Thanks in advance.

confus3dconfus3d

I've managed to create and upload the package with test class.

 

When I try to install to my production org, I get the error

 

"Package Compatibility Error

 

The requested package requires the latest release of salesforce.com....."

 

I selected version API 17.0 when building and have  tried compiling using version 13.0 but still get the same error? 

 

What do I need to change?

jkucerajkucera

Hmm-changing the API version has worked for me in the past.  Did you package anything in addition to code?  Currently the developer edition servers (Na7) are on the Spring '10 release (API 18.0) where most customer orgs are on Winter '10 (API 17.0). 

 

That may be the cause of the problem, but I don't think it's an issue if the package is only code.

 

If you are familiar with Eclipse, that may remove the issues, but requires a bit of setup to configure.