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

Saving Triggers/Classes to Salesforce via Eclipse

Ok, I've read a dozen threads and all the documentation I can find but still can't seem to get the gist of how to save objects to Salesforce. I etiher end up receiving insufficient coverage messages or the items just don't seem to save anyway. Somehow, I managed to save a trigger and its test class to Salesforce yesterday. Today, I tried adding another class and trigger but the coverage errors were blocking me. The new class kept validating against the old trigger and not the new one. I then deleted all my objects to get a fresh start (I saved the code in local text files first). Now, when I try to save items, they don't get saved in Salesforce but there is no "only saved locally" message.

Can someone please give me a step-by-step list of how I go about creating Apex Triggers/Classes and saving them to SF through Eclipse? In my scenario, I am trying to create two triggers (on different objects). One of the triggers will be calling a method from another class.

I'm using Eclipse and the Apex Toolkit (not using due to rollbackOnError issue). Also, I am using the Enterprise Edition of Salesforce.

UPDATE: I have finally gotten both triggers onto Salesforce. I had to use a single class for all my methods. Within this class, I created a single testMethod that runs tests against all objects.  My new issue is getting updates saved. When I modify my code and save it, it does not seem to get pushed out to Salesforce. Any thoughts?

Message Edited by MikeD13 on 01-16-2008 02:08 PM

Hi Mike,

Well i am not very clear what is your problem but creating classes and triggers is very easy.

Just go through this:

For new Class in Eclipse:

1. Right click on apex classes subfolder of your project on project explorer -> apex -> new class.

2. Write the code and save it from here only ctrl + s will do.

For new Trigger in Eclipse:

1. Right click on apex Triggers subfolder of your project on project explorer -> apex -> new Trigger.

2. Write the code and save it from here only ctrl + s will do.
Do reply if you are facing some other problem, i'll help you if i can.
-Abhishek Singh
I understand how to create the objects and save them within Eclipse. I am having problems saving them to Salesforce in production at the same time. Even when I don't get the "file only saved locally" message (for whatever reason), the object still doesn't seem to make it to SF. If and when it finally does, any changes I make don't seem to make it (again only saves the changes locally with no message).

The other question I have is in regards to setting up tests. I had created one class and one trigger and finally managed to get them over to SF. I then wanted to create a second trigger and class and save them up to SF. The new class was only testing itself and the old trigger even though the testmethod in the new class was only specific to the new trigger. The new trigger was being completely ignored (untested) and therefore would not make it up to SF at all. I managed to work around this by combining all of the methods and tests into one class and testmethod. Is this the correct way to do it? Can we only load one class from Eclipse?

Just so you know, I do seem to have it all working fairly smoothly now. The trick is to code against my sandbox first and then use the deploy option to my production environment (so far.. so good). I just can't seem to save directly from Eclipse to SF EE in production.

Sorry for going on for so long.

You got it right Mike, well you can go thorugh Eclipse help for Apex if you face any such problems ,you will get all the answers over there. :)

Hi everybody,

It's been a while sins this post, but I am having mayor difficluties with eclipse.

All is working well. I have my sandbox, devolper and real environment installed. A class in the sandbox works fine, when I test it in eclipse it gives me an error. Same as above, can't get it to work. If I test the class in the sandbox, no errors, what am I doing wrong. Also how do I get this class from my sandbox to my real environment?

Problem is, that my my help file is not working, it keeps giving me a "can't find the webpage error" as if I am offline, but I am not! Changed settings, reinstalled everything, it doesn't work

Please any link to a good help file or some tips it driving me ....... :smileysad:

Hope to hear from you



Hi Mike - I am having some probs saving an Apex class to salesforce suing Eclipse.  Did you ever figure this out using more than one class

Has this issue been solved?  


I had 80% test coverage and today in Eclipse I cannot get all my test methods to run.  But if I run the tests in the sandbox I get the 80% coverage.  Is this a bug with Eclipse?