0

I am not a developer but would like guidance into an issue a specific User sees when trying to add List Members to a Campaign. This only applies in Prod and not UAT. Not sure where to begin.

A component error has occurred: Message: Uncaught Error in $A.getCallback() [ErrorAttempt to de-reference a null object] Callback failed: apex://TCL_Contact_ctrl/Actions$getContactsCtrl

Component Descriptor: markup://c:Base Filename: https://ourcompany.lightning.force.com/lightning/r/Campaign/7015Y0/components/c/Base.js Line 40, Column 31 Function: Object.eval

Thanks for any help

Aron

1 Answer 1

0

All that we can really say with certainty is that you have an Apex class, TCL_Contact_ctrl, with a method called getContactsCtrl, that is throwing a Null Pointer Exception (NPE).

An NPE occurs when a developer tries to access an object that doesn't exist. To explain it to layperson, imagine someone gives you an address and invites you to their home. However, when you arrive, the address/home doesn't actually exist.

This is distinctly separate in programming from what we'd call an "empty" value; the house is there but nobody's home. Assuming it's not a logic bug, the user may have forgotten to fill in a field, so make sure they're filling everything in.

As a practical example, consider:

Integer x;
Integer y = 5;
Integer z = x / y;

Because the default value for a variable is null, we have not assigned a value to x. When we try to calculate z, we get an NPE. As you can tell, it's distinctly different than the number 0 in this example:

Integer x = 0;
Integer y = 5;
Integer z = x / y;

Here, we get the perfectly valid answer of 0. Nulls, and the associated NPEs, was once called by the original developer that introduced the concept of nulls as a "billion-dollar mistake." Many developers even fail to understand what an NPE is or how to fix it.

So, in the end, you might want to call in a developer to have them look at that code. Conceptually, well-written code should never, ever throw an NPE. They're completely avoidable 100% of the time with some effort and discipline. Training your users to work around NPEs is generally not a good idea. Getting someone in there to fix the code is.

1
  • Thanks for the detailed response @sfdcfox! I appreciate it. The developers were able to see a bit more but still some nuances, ie there is a variable which is passed from Aura to apex which is been set as null, though they are not clear why that is. At this point Salesforce support is involved so hopefully we can get this resolved. I appreciate this which help if future issues!
    – Aron Schor
    Commented Jul 29, 2022 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .