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
Emily Walton 22Emily Walton 22 

Apex trigger error: Attempt to de-reference a null object

I am not a developer but I am supposed to trouble shoot this apex trigger error. Can someone help let me know what I need to change in the code to fix it? 

Error:Apex trigger RHX_Turbine_Config caused an unexpected exception, contact your administrator: RHX_Turbine_Config: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Class.rh2.AggregateFunctionWorker.handleMultipicklistValues: line 23, column 1

Code:


1 trigger RHX_Turbine_Config on Turbine_Config__c
2    (after delete, after insert, after undelete, after update, before delete) {
3     Type rollClass = System.Type.forName('rh2', 'ParentUtil');
4  if(rollClass != null) {
5   rh2.ParentUtil pu = (rh2.ParentUtil) rollClass.newInstance();
6   if (trigger.isAfter) {
7     pu.performTriggerRollups(trigger.oldMap, trigger.newMap, new String[]{'Turbine_Config__c'}, null);
8       }
9    }
10}
  
    
  
    
   
     
    

 
Nayana KNayana K
It is difficult to predict the cause with only little information.
Can you please share ParentUtil and AggregateFunctionWorker class codes too?
Niket SFNiket SF
@Emily Walton 22 go to line  ggregateFunctionWorker.handleMultipicklistValues 23 and see if you can add null condition.

 If its manage package, Then check the user guide you must be missing some configurational data.

 
Emily Walton 22Emily Walton 22
ParentUtil and AggregateFunctionWorker are both APex Classes from a managed package: Rollup Helper. 

User-added image
User-added image
Emily Walton 22Emily Walton 22
So is the problem with the Rollup Helper classes? And not the custom apex trigger? 
Nayana KNayana K
Hi Emily,

My bad (I don't know how I missed this basic concept). In manage package we can't see the class code. 

Applogies. Please follow the instructions which Niket has shared.
Heather Hicks 16Heather Hicks 16
Hi Emily, I'm not sure that the Trigger.OldMap and .NewMap variables apply to all Trigger.IsAfter scenarios (for example, Trigger.NewMap doesn't apply if the record was deleted, and Trigger.OldMap doesn't apply to inserted or undeleted records). I can't tell, though, if that's where you are seeing the error.