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
rlupurlupu 

I cannot activate a trigger created in Eclipse

I have to write some code for a Salesforce Enterprise edition that doesn’t allow me to create/modify/drop triggers or Apex classes by using the interface.

I managed to create a trigger by using Eclipse.The Salesforce interface shows me that the trigger code is completely saved and is valid. However, I cannot activate the trigger either by using the Salesforce interface or Eclipse.

I think I miss something here. Can someone help, please?

Thank you

VIKTORVIKTOR
You cannot write triggers directly in Salesforce. Need to create them in Sandbox and then deploy into Production.
HardhatHardhat
I expect you may be missing a testMethod.  Do you see an error in the Problems tab saying you do not have adequate test coverage?
 
I am also having this issue, although in my case I do have adequate test coverage (or at least I've written a class with a testMethod that should give me 100% coverage); I'm completely flummoxed as to why I am unable to activate my trigger.
paul-lmipaul-lmi
same here.  i had to manually edit the metadata xml, and then redeploy it.  there's an xml tag for active that you can force to true before you deploy.

what'd really be nice is if this was actually documented.  every single roadblock i've hit with apex in production thus far has been due to undocumented restrictions they have in place in production but not development orgs.  it's like they don't want people using it...
rlupurlupu

Thank you, Viktor

There's no Sandbox for that Salesforce production environment I had access to. However, I could create the trigger in my developer environment and deploy it with Apache ANT in the production one (after providing enough test coverage).

rlupurlupu
Thank you, HardHat
 
It's true that my test coverage wasn't appropriate. 
It's strage that, when I'd tried for the first time to save the trigger in the production environment (at that time it had no test coverage), I got no error message or warning. The trigger was there, but inert, so I removed it.
After a while I tried again and finally got the error message '..0% test coverage..'. This time, the code of the trigger wasn't visible in the Salesforce interface, like before.
Inconsistency... :-(
rlupurlupu
Thank you, Paul
 
I'm afraid there are many developers frustrated by the rather poor documentation that comes for Salesforce. However, this developer community compensates,so thank you all for that.