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
rwalrath144rwalrath144 

Can't deploy class and trigger... Please Help!!

I have created a class and trigger to process inbound emails in Sandbox. I get 100% coverage on my class and 94% coverage on my trigger. When I take it into Eclipse to deploy I only get 74% with the same exact code.

 

Is there a way to deploy from Sandbox without using Eclipse?

Best Answer chosen by Admin (Salesforce Developers) 
JonPJonP
Hmm, looks like you are using an old Developer Preview version of the IDE.  You should consider upgrading to the latest release.

All Answers

JonPJonP
When you deploy to production, the code coverage numbers are calculated by running all tests already in the organization and in the code you are deploying.  Or it could be that your tests are querying data from the database (which they shouldn't do), in which case different data in sandbox vs. production could cause different code paths to be executed by your tests, thus lowering the coverage #s.
rwalrath144rwalrath144

I am really at a loss on what to do at this point. These are the errors I am getting and my trigger is below.  I could really use some help here. I am at best an amateur with code.

 

Severity and Description Path Resource Location Creation Time Id
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CheckFieldValues: execution of BeforeInsert

caused by: System.ListException: List index out of bounds: 1

Trigger.CheckFieldValues: line 16, column 38  CS tools_Salesforce line 1 1248887126156 155

Trigger.CheckFieldValues: line 17, column 38  

Trigger.CheckFieldValues: line 19, column 38  

 

trigger CheckFieldValues on Case (before insert) {

 

 

 

for (Case c : Trigger.new) {

 

if (c.Subject == null) {

 

c.addError('Subject cannot be blank!');

 

}

 

String[] Field_Values;

 

Field_Values = c.Description.split('\\|',0);

 

//c.IncidentAssignTo__c = Field_Values[1];

 

c.Client__c = Field_Values[2];

 

c.Primary_Invoice_Number__c = Field_Values[3];

 

c.Order_Amount__c = double.valueOf(Field_Values[4]);

 

c.Consumer_Contact_Phone_Number__c = Field_Values[5];

 

c.IP_Address__c = Field_Values[6];

 

c.Consumer_Contact_Email__c = Field_Values[7];

 

c.Address_1__c = Field_Values[8];

 

c.Address_2__c = Field_Values[9];

 

c.Description = Field_Values[10];

 

c.IncidentReason__c = Field_Values[11];

 

c.Sub_Incident__c = Field_Values[12];

 

c.Priority = 'P2';

 

c.subject = 'Credit Verification';

 

//c.Processed__c = 1;

 

 

 

}

 

}

rwalrath144rwalrath144

I try to run tests using Execute Anonymous as the Apex book says but I recieve this error:

 

DEBUG LOG

Failed to send request to https://na4-api.salesforce.com/services/Soap/s/14.0/00D3000000007x7

 

JonPJonP
Hmm, looks like you are using an old Developer Preview version of the IDE.  You should consider upgrading to the latest release.
This was selected as the best answer
rwalrath144rwalrath144

I upgraded to the latest. I am getting the same errors plus

 

Severity and Description Path Resource Location Creation Time Id
Save error: Unable to perform save on all files: An unexpected error has occurred. Please try again, or check the log file for details. CS tools_Salesforce/src/triggers CheckFieldValues.trigger-meta.xml line 1 1248901917921 175

 

rwalrath144rwalrath144
Is there anybody who can help me? I have researched all I can and still can't come up with an answer.
WooterWooter

I have been having this same problem.  It isn't a Test Percentage problem.  I just can't get my code to production.  I have tried updating Eclipse and that hasn't helped either.

 

Maybe Cloud computing isn't all its cracked up to be...

JonPJonP
Please open a support case and provide the error # returned from the server.