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
cmarkcmark 

triggers in Enterprise Edition - are people having success?

Hello.

I have had nothing but trouble deploying/updating/activating triggers in EE (no problem in DE).  I check the forums and found many people saying the same thing.  However I assume than most people are able to deploy/run triggers in EE without a problem?  Please respond if you're able to reliably work with Apex in EE.

Thanks
Chris


jeremy_wjeremy_w
Hi Chris

I've deployed only a few triggers in EE and they work fine.

One thing I noticed was that if triggers are created in Eclipse they default to "de-activated". Therefore after creation in eclipse I saved to the developer account, closed eclipse, logged into salesforce into the developer account and marked the triggers as active. Then opened eclipse and selected "refresh from server" or something. It picked up the active flag and then when the trigger was deployed to production, it was deployed as active.
I'm sure there's a better way and perhaps this is not the problem you're getting but hopefully this may help.

Jeremy
cmarkcmark
Jeremy - thanks for the response - I haven't tried that approach for activating a trigger before - I'll try that.

Any tips on test coverage?  I deply to DE, and eclipse tells me that coverage is 85%.  Then I try to deploy the exact same code to EE and it says that my coverage is 15%.  (Numbers are approximate.)

Chris
jeremyfrey1jeremyfrey1

I've run into similar problems with the Eclipse toolkit.  I'd use Ant for deployment -- it seems to give more accurate numbers for test coverage.  While deploying a trigger last week, Eclipse forbid me due to thinking the trigger had 66% test coverage; run Tests in sandbox and Ant both said that the trigger was covered 100%.  It probably has something to do with the way the tests and triggers are copied -- this may go away if you use the actual deployment tool within Eclipse, but I've not yet been able to get that to work.

Also, there may be configuration differences between test and production which is causing the 15% code coverage vs 85%.  From what I've seen, it looks like if your unit test encounters an unexpected error in production (a different record id if you're hard-coding ids into your test, configuration setting, etc) that it didn't encounter in sandbox, it will halt testing, and count only the lines it's been able to test so far. 

 

- Jer (a different one)

cmarkcmark
Interesting - okay - I'll try Ant.  (I assumed that Eclipse was calling the Ant process so I wouldn't see any difference, but maybe this is a bad assumption).  That said, I'm seeing occasional quirky behavior with the eclipse plug-in.  Sometimes when I try to run my test code, it gives me some odd error message which I can't remember at the moment - I've seen other people mention that in the forums too.  Maybe I'll have better luck with Ant.

FYI, I'm not hardcoding Ids or anything in my test cases, so I must be doing something else wrong...

thanks again for your time!
chris
jeremyfrey1jeremyfrey1

I haven't had much confidence with Running Tests or deployment through Eclipse -- it appears as though when you run tests through Eclipse, it only runs the tests in a given class, but counts that against the entire package or organization.  I'll have issues while writing a test class that Eclipse says only covers 30% of my organization's code, but that's because it's testing it against every other trigger and class out there.  The "Run All Tests" button within SFDC shows a more accurate 95%.

I'm sure both Ant and Eclipse use the Metadata API, the complieAndTest method.  The methodology isn't different, but the extra code around it seems like it.

- Jer

MarkL.ax269MarkL.ax269
I'm working, but there are some definite quirks with it.
  • Latest Force.com toolkit is MUCH better in that you can deploy selected components instead of trying to deploy everything.
  • I've noticed that running tests in Eclipse is accurate for me, provided I'm deploying just a single trigger/class.  It seems to run the test against only that code, as I would expect.  It's also highly dependent on having test coverage on any other dependant triggers/classes.
  • Still no way to deactivate a trigger in production - Salesforce PLEASE provide a way to do this!  If I try to deploy an inactive trigger, Eclipse fails all tests because the trigger is inactive.  I'm left with commenting out the code.
That said, the triggers themselves are working fine and deployment is working within Eclipse for me.
DaGunsterDaGunster
no success either.

Lots of overtime hours and weekends burnt .

Got the apex code to compile - but absolutely no help getting the thing to deploy.

When I ask, they say "cover 75% of your code" - and that is all the help you get.

Waste of time - lots of time.

Severely disappointed and going to my management.
JohanLiljegrenJohanLiljegren

MarkL wrote:
  • Still no way to deactivate a trigger in production


I just wrote a [post] on this, after having suffered from this for weeks.
In short: It's not straight forward, but it's possible to deactivate a trigger in Production.

//Johan