• Benjamin Lee
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I have created a trigger which will change the asset date field when contract date changes.
The test codes only worked with Account, Contacts and Assets.
At the Sandbox, everything works fine with a 96% coverage, but it fails badly in production

It says at deployment validation that:
Component Errors

 

API Name
Type
Line
Column
Error Message
0 0 TestCaseEscalationAndOthers.CaseEscalationTest(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] Class.TestCaseEscalationAndOthers.CaseEscalationTest: line 8, column 1
0 0 CaseUpdateJobScheduler.CaseUpdateJobScheduler1(), Details: System.AsyncException: The Apex job named "Case Subject Update" is already scheduled for execution. Class.CaseUpdateJobScheduler.start: line 7, column 1
0 0 ApexScheduledClass.testSchedule(); null, Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] Class.ApexScheduledClass.testSchedule: line 59, column 1; Average test coverage across all Apex Classes and Triggers is 27%, at least 75% test coverage is required.
0 0 updateCasesAfter60Mins.updateCasesAfter60Mins(), Details: System.DmlException: Update failed. First exception on row 122 with id 500w000000nwwg5AAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact does not belong to the specified Account: [ContactId] Class.updateCasesAfter60Mins.UpdateOpenCases: line 18, column 1 Class.updateCasesAfter60Mins.updateCasesAfter60Mins: line 25, column 1

Apex Test Failures

 

Class Name
Method Name
Error Message
ApexScheduledClass testSchedule System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] 
Stack Trace: Class.ApexScheduledClass.testSchedule: line 59, column 1
CaseUpdateJobScheduler CaseUpdateJobScheduler1 System.AsyncException: The Apex job named "Case Subject Update" is already scheduled for execution. 
Stack Trace: Class.CaseUpdateJobScheduler.start: line 7, column 1
TestCaseEscalationAndOthers CaseEscalationTest System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] 
Stack Trace: Class.TestCaseEscalationAndOthers.CaseEscalationTest: line 8, column 1
updateCasesAfter60Mins updateCasesAfter60Mins System.DmlException: Update failed. First exception on row 122 with id 500w000000nwwg5AAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact does not belong to the specified Account: [ContactId] 
Stack Trace: Class.updateCasesAfter60Mins.UpdateOpenCases: line 18, column 1 Class.updateCasesAfter60Mins.updateCasesAfter60Mins: line 25, column 1

Those components that failed were not what Iadded to my change sets for deployment.
Why do they show error here?

Any help is appreciated.

Ben
I have created a trigger which will change the asset date field when contract date changes.
The test codes only worked with Account, Contacts and Assets.
At the Sandbox, everything works fine with a 96% coverage, but it fails badly in production

It says at deployment validation that:
Component Errors

 

API Name
Type
Line
Column
Error Message
0 0 TestCaseEscalationAndOthers.CaseEscalationTest(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] Class.TestCaseEscalationAndOthers.CaseEscalationTest: line 8, column 1
0 0 CaseUpdateJobScheduler.CaseUpdateJobScheduler1(), Details: System.AsyncException: The Apex job named "Case Subject Update" is already scheduled for execution. Class.CaseUpdateJobScheduler.start: line 7, column 1
0 0 ApexScheduledClass.testSchedule(); null, Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] Class.ApexScheduledClass.testSchedule: line 59, column 1; Average test coverage across all Apex Classes and Triggers is 27%, at least 75% test coverage is required.
0 0 updateCasesAfter60Mins.updateCasesAfter60Mins(), Details: System.DmlException: Update failed. First exception on row 122 with id 500w000000nwwg5AAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact does not belong to the specified Account: [ContactId] Class.updateCasesAfter60Mins.UpdateOpenCases: line 18, column 1 Class.updateCasesAfter60Mins.updateCasesAfter60Mins: line 25, column 1

Apex Test Failures

 

Class Name
Method Name
Error Message
ApexScheduledClass testSchedule System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] 
Stack Trace: Class.ApexScheduledClass.testSchedule: line 59, column 1
CaseUpdateJobScheduler CaseUpdateJobScheduler1 System.AsyncException: The Apex job named "Case Subject Update" is already scheduled for execution. 
Stack Trace: Class.CaseUpdateJobScheduler.start: line 7, column 1
TestCaseEscalationAndOthers CaseEscalationTest System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter the Phone Number (Format : Std Code-Phone Number): [Phone] 
Stack Trace: Class.TestCaseEscalationAndOthers.CaseEscalationTest: line 8, column 1
updateCasesAfter60Mins updateCasesAfter60Mins System.DmlException: Update failed. First exception on row 122 with id 500w000000nwwg5AAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact does not belong to the specified Account: [ContactId] 
Stack Trace: Class.updateCasesAfter60Mins.UpdateOpenCases: line 18, column 1 Class.updateCasesAfter60Mins.updateCasesAfter60Mins: line 25, column 1

Those components that failed were not what Iadded to my change sets for deployment.
Why do they show error here?

Any help is appreciated.

Ben