+ Start a Discussion
sroberts_MEsroberts_ME 

Deploying code

Hi all,

 

Im trying to deploy a single apex class and visualforce page into our production environment, but whenever I try to verify the change set I get the following error:

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Class_Code__c]: [Class_Code__c]", Failure Stack Trace: "Class.OpportunityLineItemServicesTest.TRAINING_DOUBLE_ENTITLEMENT: line 161, column 9 External entry point"

 

Similar errors are shown as well, but all have to do with the field Class_Code__c. I looked into this field and found that it was in our production environment, but not our sandbox. I tried adding the field and uploading the changes again with no luck. I'm not sure where this error even comes from because my code doesnt touch the class object or any related objects. Any ideas?

 

Thanks,

sam

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Validating the change set will run all unit tests in the target org.  Is OpportunityLineItemServicesTest part of your deployment or an existing test class?  If its an existing class, have you tried running all unit tests in your target org as they currently stand?

 

I've certainly encountered the situation before where I can't deploy code as existing unit tests have broken, often by a field become required or a new validation rule.  In my experience the only way around this is to correct the failing unit tests.