0

I updated a custom object that existed in production with a new field (Approval_Status__c, picklist). That object was queried by a controller (apex class) in production, as well. All I want to do is update the controller so that it queries the new field. I was able to edit the apex class in sandbox with the additional new field and went through the steps to deploy the edited controller as outlined here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_deploy.htm

Unfortunately, I cannot seem to get the deploy to succeed past the testing stage. I'm not sure why this is because I don't think that the addition of the field would be enough to break the code. (For reference, the only line that has changed is from

return [SELECT Category__c, Credits_Earned__c, Date_Approved__c, Date_Earned__c, Title__c FROM Recertification_Activities__c WHERE Program_ID__c =: rid];

to

return [SELECT Approval_Status__c, Category__c, Credits_Earned__c, Date_Approved__c, Date_Earned__c, Title__c FROM Recertification_Activities__c WHERE Program_ID__c =: rid];

Any suggestions on how to get through the testing would be greatly appreciated.

  • Can you edit your question to include the error that you're getting? It might also help if you added your controller and the test method that is failing. Are you sure this is the only change being made? – Derek F Oct 31 '16 at 15:42
  • First step, In production - Setup->Develop->Apex tests -> run all tests. I bet that they are failing now without your deployment and are unrelated to your change. Simply adding a field to a query is highly unlikely to cause a test to fail. – Eric Oct 31 '16 at 15:55
0

I am going to say with 99% certainty that the issue is not related in any way to your current deployment attempt.

I believe your tests are currently in a state where they will not pass in production without any deployment being attempted. This can happen over time if tests are not properly written.

To verify follow this path:

Login to production Setup -> Develop -> Apex Test Execution -> Select Tests -> Check box for all -> Click run

if any of the tests fail then any deployment you make will fail and you should review the reasons why the tests fail and determine if it is an improper test or if it is actually pointing you to a potential problem.

Some ways to get your deployment completed:

  1. Fix the test methods or the process that is broken
  2. When deploying select "Specified tests" and enter the name of the test class that tests the controller you are deploying.
| improve this answer | |
  • Sure enough, the test class that tests the controller I'm deploying gives a result of (0/0) Test Methods Passed; when all the others have finished, it still says that the "[s]elected job is not complete." I have a feeling it will never say that it is complete. – bblohowiak Oct 31 '16 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.