• Edmondo Porcu 2
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am trying to pass the "Apply Domain Layer Principles" assignment in Developer Advanced but I get stucked to the following issues:

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.fflib_SObjectDomain.triggerHandler: line 345, column 1 Class.fflib_SObjectDomain.triggerHandler: line 321, column 1 Trigger.AccountsTrigger: line 5, column 1: []

The error occurs in line 345 of  Class.fflib_SObjectDomain.triggerHandler (the second one in the snippet)
Type constructableClass = domainClassName.endsWith('Constructor') ? Type.forName(domainClassName) : Type.forName(domainClassName+'.Constructor');
			IConstructable domainConstructor = (IConstructable) constructableClass.newInstance()
So it seems that Apex Commons can't retrieve by reflection the instance of the domain class (which is called Accounts). Has this something to do with the version of the API I am running?
 
Working on assignment where I'm getting the below error in fflib_SObjectDomain class.
Apex trigger AccountsTrigger caused an unexpected exception, contact your administrator: AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Class.fflib_SObjectDomain.triggerHandler: line 346, column 1

This line is 
Type constructableClass = domainClassName.endsWith('Constructor') ? Type.forName(domainClassName) : Type.forName(null,domainClassName+'.Constructor');