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

Eclipse IDE cannot detect the changes

I have a few classes and a trigger deployed in my env. I had deployed these using the IDE in Eclipse.
I made a few changes today in the trigger, but the IDE cannot detect the changes when I try to validate the deployment.

Has anybody seen this before ? How do I force the IDE to recognize the changes

Thanks in advance
Two things to check...

First, check that there were no errors generated when the changes were saved. Sometimes, the changes will be saved locally but not on the server (eg where there is an error in the code).

Second, you might want to use the "Refresh from Server" command under the menu -- this will reload all code from the Server. Warning: You might lose your changes where the code was not saved on the server (as above), so keep a copy of your changed code.
Thanks John

I have done both of them. The only change is a trigger change from before to after on an update. I still can't get the change to be recognized
Is it saved, working and visible in your sandbox environment? That is, if you look at the trigger via the main SFDC web interface, does the Trigger show up as expected?

And are you saying that when you choose the "Deploy to Server" function, it is colored gray, so you can't migrate it?

You could try opening your Production instance in Eclipse, then deleting the trigger. That should kick the Deploy command into a bit of sense.
Some more info - I additional select to create a project zip archive during the step 2 and the file contains the trigger with the changes.
So looks like the system knows about the changes.
But on the next step it shows that no change is detected
This is in my prod env.
I go to 'deploy to server' after making the change and then put in the credentials and create a project archive.
On step 3 all the items in my project file are grayed out with no change detected.
In teh project archive I see the changes fine


The way I do things is that I develop under my Sandbox environment. Then, when I want to move to Production, I choose "Deply to Server", enter the credentials for my Production system, and then it copies the files from the Sandbox to Production.

If you are developing directly against your Production system, then you won't need to Migrate -- it's already there!  Mind you, it is not recommended to develop directly against your Production instance.
Yes, I agree.
I made the changes direclty on the sandbox environment ( web interface ) to test and validate the logic.

Now I am deploying against the prod env by putting in my prod credentials. And this as required is via the Eclipse IDE.
Is that messing it up ?

Can you explain when you mean if I am developing on production it is already there? When I go into the web and look  at the trigger the old trigger is as is


Sounds like you're probably doing things okay, but here's an explanation...

The Eclipse "Project" needs login information to SFDC. In my case, I give it my Sandbox credentials. Therefore, all code and tests operate within the Sandbox.

When I tell it to Deploy, it asks for credentials for the destination system. That's when I give it my Production credentials.

This causes it to migrate from the Sandbox (the product's credentials) to Production (as entered when I chose to Deploy). The migration screen compares the code stored in each environment, showing which ones have changed.

If all else fails, try creating a new project within Eclipse (against your Sandbox), check the code in there (to ensure it has the desired version), then try to Deploy to Production. That might kick some sense into it.
I will try and create a new project from sandbox and try to deploy to prod. Thanks. Will let you know how this goes
The testclasses should have sandbox values or the production values ?
I am assuming production as I need to deploy to prod? Please clarify

MDXHiker wrote:
The testclasses should have sandbox values or the production values ?
I am assuming production as I need to deploy to prod? Please clarify


Preferably, there should be no values in your tests that are instance-specific.

For example, to test for a specific RecordTypeId, retrieve the id from the RecordType table by name (eg select Id from RecordType where Name = 'My record type').

To test, say, for an Opportunity against a particular Contact, create both the Contact and the Opportunity. It's best not to test against values already in the database since you've got no guarantee that they will be there in future (and they certainly won't be in a different instance).

Everything run within a test is rolled-back, so you won't be messing up your system with test data.

Here's an example from one of my tests:
public class TriggerTest_ProductsUpdateCampaigns {

 static TestMethod void testProductsUpdateCampaigns() {

  // Create some Contacts
  Contact contact1 = new Contact(LastName = 'Contact 1', EmailAddr__c = '');
  Contact contact2 = new Contact(LastName = 'Contact 2', EmailAddr__c = '');
  Contact[] contactarray = new Contact[]{contact1, contact2};
  insert contactarray;
  // Create a Campaign  with auto-close
  Campaign c1 = new Campaign(Name = 'Test with auto-close', Auto_Close_Purchase__c = 'jira', StartDate = Date.newInstance(2007, 01, 01));
  insert c1;
  System.debug('Campaign C1 = ' + c1.Id);
  // Add statuses to campaign
  CampaignMemberStatus cms = new CampaignMemberStatus(CampaignId = c1.Id, Label = 'Purchased', HasResponded = true, SortOrder = 3);
  insert cms;
  // Test 1: Create a Campaign Member
  CampaignMember cm1 = new CampaignMember(ContactId = contact1.Id, CampaignId = c1.Id, Status = 'Sent');
  insert cm1;
  System.debug('Member cm1 = ' + cm1.Id);
  // Create a product that should auto-close
  ATLProduct__c product1 = New ATLProduct__c(Name = 'Test product', Product_Family__c = 'jira', Technical_Contact__c = contact1.Id);
  insert product1;
  CampaignMember cm1test = [select Id, Status from CampaignMember where Id = :cm1.Id];
  System.assertEquals('Purchased', cm1test.Status);  
} // class

You'll see that I create all of the records that I need for testing, without expecting anything to be there.

If you think you have a situation where this won't be possible, please share your situation and we can see if there's a way to test it for all environments.
Alright, I finally was able to make changes in production.

I created a new project in Eclipse from the Sandbox env and updated the test classes - and then was able to publish it to prod env from there.

The strange thing is that when the project is got from sandbox, any changes made in the project are directly updated to the server even before the deploy.
If the same thing is done on production ( create a new project with production code) and any changes made the changes are not saved on the server and this is true even after the deploy.

I would have expected the behavior to be the same on sandbox and prod.

When I intially deployed this project a while ago the behavior was different in that I could directly save on to the production instance once the code coverage was upto the mark. For a change I had to take the sandbox project and push that to production.
So behavior is different for new code and an existing code.

Thanks for your help John