Questions tagged [null-pointer]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
2 votes
1 answer
77 views

A Variable Passed from my LWC to Apex Becomes Null

ISSUE The parameter name of my Apex method did not match the name of the variable when I called the method from JavaScript. ORIGINAL QUESTION I've never touched frontend before - I have no clue ...
user avatar
-1 votes
0 answers
12 views

LWC - NullPointerException Insert ContentVersion(.cls)

I'm getting a NullPointerException error. Not sure if I'm doing it correctly. Any ideas? In this screenshot there is console.log for the base64 data. .cls public static string uploadImage(String ...
user avatar
  • 99
-3 votes
0 answers
25 views

Error Occurred: An Apex error occurred: System.NullPointerException: Attempt to de-reference a null object

I have Apex code that fired from Flow. The conditions for this Flow is when the user choose a specific record type. I create a new record type for this object and add this record type to the condition ...
user avatar
0 votes
0 answers
19 views

NullPointerException while trying to update picklist using Metadata Api

Trying to update a picklist value in the status field of Lead object using Metadata Api. Running into NullPointerException. Here is the code used to update picklist Value. String picklistapiname = '...
user avatar
1 vote
1 answer
550 views

Resolution to this error: Attempt to de-reference a null object

I am new to Salesforce Apex coding and I am getting this null pointer exception error when i try to run a schedule batch. Please help me as i am unable to understand the mistake i made. The code is ...
user avatar
0 votes
0 answers
30 views

AdvancedGapMatrix - resourceIDToScheduleData NullPointerException

I'm trying to create a new class that check for available slots of time according to ServiceAppointment for a Service Resource. I decided to use FLS Standard methods. My code is: private static ...
user avatar
  • 165
0 votes
0 answers
27 views

Error with ContentDocumentLink insert null pointer

I am trying to create a salesforce file and link to it.But when i run the code i get an error BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object on the line ...
user avatar
  • 1
0 votes
2 answers
120 views

Null pointer exception inside for Loop

Here is the code: for(Requests curRequest : requestList){ if (curRequest.varSRProduct!= null ){ for(SObject so : curRequest.varSRProduct){ //code } } ...
user avatar
0 votes
1 answer
152 views

Null pointer exception using null safe navigation operator

Following scenario throws nullptr exception inside if condition block !sample?.SomeField__c: MyObject__c sample = null; if (!sample?.SomeField__c) { ... } Why is that? Shouldn't that be evaluated ...
user avatar
  • 342
0 votes
2 answers
62 views

Need help with a mystery null pointer exception

I'm getting Null Pointer Exception from some recent code changes and I can't figure out where it's coming from. I've put ** around the new code. Any help would be appreciated! System.DmlException: ...
user avatar
0 votes
1 answer
60 views

Deploy error: List has no rows for assignment to SObject and INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

I am trying to deploy a destructive package, but I am receiving the following errors in test classes: System.DmlException: Insert failed. First exception on row 0; first error: ...
user avatar
  • 123
-1 votes
1 answer
45 views

Handle Null Pointer exception in better way while assigning value

In this example had shown only 2 fields, Need to handle many fields. For checking, null pointer exception for each fields are really tedious Task. Any Easy way to do this. Apex Class: public class ...
user avatar
  • 2,254
-1 votes
1 answer
102 views

How to fix System.NullPointerException: Attempt to de-reference a null object in a Batch

I have a batch and I can't figure out how to fix System.NullPointerException error going through my debug log my kes variable is null for (Known_Error_Subscription__c kes : scope) { kes....
user avatar
0 votes
1 answer
45 views

knowledge__kav: System.NullPointerException: Attempt to de-reference a null object

I am unable to fix the error System.NullPointerException: Attempt to de-reference a null object on my trigger. Could someone help? Thanks trigger Knowledge_kavKnownErrorSubscription on Knowledge__kav (...
user avatar
0 votes
2 answers
399 views

How to handle null keys in JSON response?

I have a json response class like this: public with sharing class Response { public Person person; public class Person { public PersonData personData = new PersonData (); ...
user avatar
  • 456
0 votes
1 answer
316 views

Error when generating a JAR with Enterprise WSDL

I have generate Enterprise WSDL file and downloaded to my local machine. Now I'm trying to generate the jar file with following command. java -classpath .\..\..\..\..\..\.m2\repository\com\force\api\...
user avatar
0 votes
1 answer
509 views

Before Trigger: System.NullPointerException: Attempt to de-reference a null object

I'm trying to use an Apex trigger to associate Account.Name to a Contact from a community form. Here is my trigger, trigger ContactBeforeInsert on Contact (before insert, after insert) { String ...
user avatar
2 votes
1 answer
152 views

Attempt to de-reference a null object when using alternative to getGlobalDescribe

In the following code String myString = 'Account'; SObjectType sObjType = ((SObject) Type.forName(myString).newInstance()).getSObjectType(); When myString = a object name does not exist i get a ...
user avatar
  • 69
0 votes
1 answer
27 views

I tried coding for inserting candidate using custom controller [closed]

public class InsertCandidatecontroller { public Candidate__c can {get; set;} public InsertCandidatecontroller(ApexPages.StandardController controller) { } // Initialization of ...
user avatar
0 votes
1 answer
147 views

Getting a null pointer exception

I was trying to fix a null pointer exception here if(com.Employee__c != null && (mapEmployees.containskey(com.Employee__c) == null || (mapEmployees.containskey(com.Employee__c) != null &&...
user avatar
  • 507
0 votes
1 answer
198 views

System.NullPointerException: Argument cannot be null error in test class

Below is my Test Class and I am getting the error : System.NullPointerException: Attempt to de-reference a null object error on line 23 . @isTest public class ShowRoom_VisitController_Test { //...
user avatar
3 votes
1 answer
109 views

NullPointerException BeforeInsert on Lead Trigger

I am pretty new to writing custom code in SF and would appreciate any help. I have a trigger on Leads to update Status to "Contacted" when a task on that Lead is "Completed". I found this in a ...
user avatar
0 votes
1 answer
2k views

Apex Specialist Superbadge Null Reference on Challenge 4

Been spinning my wheels on this for awhile. Frustrating thing about these Trailheads is no point of reference for what tests are failing on Salesforce's end that might be producing this error. Here ...
user avatar
  • 367
0 votes
1 answer
436 views

Error deserializing json array nullpointer exception

I receive this json through a request {"pay_CCIban":"XXX", "pay_bic":"YYY", "pay_names[]":["name one","name two"], "pay_extid":"extId"} I'm trying to deserialize it with this class global class ...
user avatar
  • 33
0 votes
1 answer
516 views

Argument cannot be null in Rest Apex class

I am trying to send data from salesforce to external system and have written web service but even after properly encoding every parameter, i am getting argument cannot be null due to which data is not ...
user avatar
-1 votes
1 answer
36 views

NPE for the case object before insert

I am trying to write a method that goes through and creates the proper local timezone on the case object versus dates that could be done via the user since we might have different time zones for them ...
user avatar
  • 115
3 votes
2 answers
2k views

Comparision directly on null value safe?

So many times, we do a null check of a field value and then compare them boolean checkAmountGreaterThan10k(Opportunity record){ if(record.Amount!=null){ return record.Amount > 10000; ...
user avatar
-1 votes
1 answer
71 views

System.NullPointerException: Attempt to de-reference a null objec

When I am trying to access the Opportunity_Item_ID__c: 00k0I00000phfpdQAC in the browser it says "Data Not Available" "The data you were trying to access could not be found. It may be due to another ...
user avatar
2 votes
2 answers
151 views

Unable to handle Attempt to de-reference a null object with map

I'm working on after update trigger. And it's throwing an exception after I'm checking null values too. i don't have any idea why it's public void AfterUpdate(Map<Id, SObject> newItems, Map&...
user avatar
  • 1,455
1 vote
2 answers
62 views

Attempt to de-reference a null object error while accessing field in the Account object

I have a Quote__c object which has a field named FieldTpReferAccount__c which refers to Account. The Account object has a custom field named FieldInAccount__c. I need to update FieldInAccount__c in ...
user avatar
1 vote
2 answers
115 views

System.NullPointerException: Attempt to de-reference a null object line in line 30

trigger UpdateApplicationStatusToEnrolled on vlocity_ins__Application__c (before update ) { Map <string,List<vlocity_ins__Application__c>> strMap = new Map <string,List<...
user avatar
  • 13
0 votes
1 answer
82 views

System.NullPointerException Question (Basic)

I am new in coding. Currently, working on a nullpointerexception challenge on Apex. Error: WarrantySummary: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference ...
user avatar
  • 1
0 votes
2 answers
1k views

Attempt to de-reference a null object - list get set

I try to add objects from 'accbetween' to 'idlist' (see the code below): public class SearchTestApex { public list <Fund__c> idlist {get;set;} public list <Fund__c> accbetween =...
user avatar
0 votes
2 answers
181 views

How to cater opportunity insertion in my TEST class

I have a method in APEX class that does variety of checks via If else conditions with some SOQL statements. I created test data(Accounts, custom object records) to test the SOQL statements and it ...
user avatar
  • 555
0 votes
1 answer
2k views

How to resolve Attempt to de-reference a null object in Apex Controller

I am trying to bind my map value to wrapper class in apex controller . I am getting System.NullPointerException: Attempt to de-reference a null object. I couldn't understand where I am going wrong. ...
user avatar
  • 207
2 votes
1 answer
415 views

Is there any way to make an Apex method parameter lazy?

Let's say I want to call a method like: doSomething(a.b.c.d.e.f()); I know that this might be an expensive operation and a, a.b, a.b.c, a.b.c.d, and a.b.c.d.e might all be null, however I would ...
user avatar
1 vote
3 answers
391 views

Before Trigger System.NullPointerException: Attempt to de-reference a null object

I keep getting a null pointer exception error as follows : System.NullPointerException: Attempt to de-reference a null object Stack Trace: Class.ColloTest_utoStudentIDTrigger....
user avatar
  • 485
5 votes
1 answer
4k views

Apex `if (Boolean) `. Null exception virtually renders this check useless and unsafe

Being that an if (booleanVariable) check, where booleanVariable is null, throws a NullPointerException, it would seem that this check is unsafe. If so why would Apex allow it? This is especially true ...
user avatar
  • 545
0 votes
1 answer
81 views

bluewolf-beyond/selector attempt to de-reference a null object

Our org uses a mix of a variety of open source packages including bluewolf-beyond/selector This is a nifty package that allows construction of sobject list filters using a builder pattern that is ...
user avatar
  • 62.3k
3 votes
4 answers
2k views

|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object on my Apex Trigger

I'm kind of new in Apex development and I'm writing a before insert, before update trigger to a custom object that is going to be upserted through an API integration. Is very basic code but I don't ...
user avatar
-1 votes
1 answer
53 views

Help Me Solve A Null Pointer

I am trying to refactor some code. Right now I have a trigger calling lots of methods. And I would like to to have it call on master method. Right now I am getting a null pointer exception. And I don'...
user avatar
0 votes
1 answer
197 views

Attempt to de-reference null object (Custom File Import)

The requirement is to import a tab separated text file and updated the records matching with some statuses then display success to for failure with the list of records. I wrote the following VF and ...
user avatar
-3 votes
2 answers
506 views

Null pointer Exception in Apex controller

I am getting "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object" in Apex controller when i click on update link pop up. Its showing in query with " ulstAsset ".I am newbie ...
user avatar
  • 1
-1 votes
1 answer
1k views

Test Class for Trigger Null Pointer Exception

I am new to apex. Getting this error System.DmlException: Upsert failed. First exception on row 0 with id aBfn000000062BMCAY; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OP_DeferralTrigger: ...
user avatar
0 votes
2 answers
191 views

System.NullPointerException: Attempt to de-reference a null object Class.CollectionMaster.getCollectionMaster: line 9, column 1

@RestResource(urlMapping='/CollectionMaster/*') global with sharing class CollectionMaster{ @HttpPOST global static CollectionWrapper getCollectionMaster(String userName){ list<...
user avatar
0 votes
1 answer
48 views

Attempt To De-reference a Null Object on a Before Trigger [duplicate]

I am trying to a write what should be a pretty simple trigger to compare an old score with a new score and increment a variable based on the difference. The default field values are set to 0. I ...
user avatar
0 votes
1 answer
461 views

Null pointer exception when using {get; set;}

I'm trying to build a custom VF quick action on the Case object that allows users to update checkboxes for case fields and also lets them add some comments that will later be posted to chatter, but ...
user avatar
  • 616
0 votes
2 answers
31 views

how to add all child in map as a list in trigger handler?

On Entity__c object on that have Event as a related list. i want when i change the owner of the Entity then Owner of the Event also get change. for this i write the trigger on after update.but from UI ...
user avatar
0 votes
1 answer
475 views

@future Attempt to de-reference null object

The business requirement is to have a lookup relation ship between a Contract and Opportunity. A field on the opportunity must get the SUM of a custom field on the Contracts which belong to the ...
user avatar
0 votes
1 answer
559 views

System.NullPointerException: Attempt to de-reference a null object: () and Querying account hierarchy

I am currently developing the code that will update al the children accounts related to this parent account if this parent account gets 's updated.  gets updated.  I have two questions: What could ...
user avatar