Find your content:

Search form

You are here

What does Developer Script Exception System.NullPointerException precisely mean?

 
Share

Subject: Developer script exception from Relias Learning :

CommentsOnClosure : CommentsOnClosure: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.CommentsOnClosure: line 47, column 1 Apex script unhandled trigger exception by user/organization: 005d0000002M0Zj/00Dd0000000fdHa

CommentsOnClosure: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.CommentsOnClosure: line 47, column 1

I am getting the above exception ...Just wondering is Developer Script Exception is type of Exception that we get for some runtime error in the apex code or is there any other meaning to it??


Attribution to: user7533

Possible Suggestion/Solution #1

The core messages in there is:

execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.CommentsOnClosure: line 47, column 1

This is indeed a runtime exception, it happend in the location as described in the error message. The System.NullPointerException type describes what precisely is happening. In your apex you're using a reference to an object that is still null. Updating your question with the code may provide us insight in what's going wrong.

To understand what a null reference exception looks like, imagine the following scenario:

Account acc;
acc.name = 'test'; //this would cause a null reference exception

While the first line declares a variable (placeholder) for an account object instance, it is still empty. Attempting to populate the name field on the empty place holder will result in a null reference, no actual object (record) can be found in the placeholder variable.


Attribution to: Samuel De Rycke

Possible Suggestion/Solution #2

Developer script execution emails are Runtime exception messages which always get sent to the 'Last Modifed By' user of the Apex class that generates the exception.

On the user record there is a checkbox 'Send Apex Warning Emails' , which should be checked in order to receive Emails.

In your case, you are receiving this email precisely for the reason mentioned by @Samuel's answer.


Attribution to: codebandit
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33426

My Block Status

My Block Content