Questions tagged [null-pointer]
The null-pointer tag has no usage guidance, but it has a tag wiki.
172
questions
-2
votes
0
answers
28
views
System.NullPointerException: Attempt to de-reference a null object on calling method from Test Class
am trying to call method for getting Opportunity by Record Id ,But it keep hitting me this exception, I have mapped everything inside Opportunity Object but still its not working .
Class :
@...
0
votes
1
answer
42
views
Null Pointer Exception when referencing a known valid field
I am writing custom before insert validation rules into a Case trigger to check fields on Account when a related Case is created.
When running my test classes they all pass which leads me to believe I ...
0
votes
1
answer
231
views
System.NullPointerException when trying to send an Outbound Message
I had a simple Flow that was working: if an Opportunity was updated then the Flow updated some values and then sent an Outbound Message. But then we tried to make it fancy, with some additional ...
1
vote
2
answers
197
views
How to address null-pointer exception
I Have the following apex code which is throwing a nullpointer exception on the line:
points = points + value;
List<JMG_ExternalSearch__c> searchList = [SELECT Id,LastModifiedDate,...
0
votes
1
answer
135
views
Trying to Update Text Area (Long) to Text Area (Rich) for all Account Records
I have a Text Area (Long) field that was encrypted so I am unable to convert it to a Text Area (Rich) field. Therefore, I created a new Text Area (Rich) field and would like to update all Account ...
0
votes
1
answer
422
views
I am getting null values for all opportunity fields
I have used a Map to get the Id of the opportunity, but I am not able to access other fields of that opportunity as I am getting null value. Also, getting an error 'Attemp to de-reference a null ...
0
votes
1
answer
30
views
a requirement to enter data in a field of contact, type_of_customer__c according to same field in account. I am getting nullpointerexception in line6
public class contactTriggerHandler {
public void beforeInsert(Map<ID,contact> newMap)
{
set<ID> s= new set<ID>();
**for(contact con:newMap.values())**
...
2
votes
1
answer
2k
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 ...
1
vote
1
answer
8k
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 ...
0
votes
2
answers
540
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
}
}
...
3
votes
1
answer
697
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 ...
0
votes
2
answers
143
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: ...
0
votes
1
answer
86
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: ...
-1
votes
1
answer
60
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 ...
-1
votes
1
answer
313
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....
0
votes
1
answer
91
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 (...
0
votes
2
answers
972
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 ();
...
0
votes
1
answer
450
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\...
0
votes
1
answer
620
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 ...
2
votes
1
answer
357
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 ...
0
votes
1
answer
34
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 ...
0
votes
1
answer
510
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 &&...
0
votes
1
answer
383
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 {
//...
3
votes
1
answer
157
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 ...
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 ...
0
votes
1
answer
693
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 ...
0
votes
1
answer
1k
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 ...
-1
votes
1
answer
50
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 ...
3
votes
2
answers
3k
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;
...
-1
votes
1
answer
74
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 ...
2
votes
2
answers
467
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&...
1
vote
2
answers
109
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 ...
1
vote
2
answers
122
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<...
0
votes
1
answer
115
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 ...
0
votes
2
answers
2k
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 =...
0
votes
2
answers
243
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 ...
0
votes
1
answer
4k
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. ...
2
votes
1
answer
505
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 ...
1
vote
3
answers
583
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....
6
votes
1
answer
7k
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 ...
0
votes
1
answer
93
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 ...
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 ...
-1
votes
1
answer
55
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'...
0
votes
1
answer
282
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 ...
-3
votes
2
answers
795
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 ...
-1
votes
1
answer
2k
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: ...
0
votes
2
answers
364
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<...
0
votes
1
answer
51
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 ...
0
votes
1
answer
640
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 ...
0
votes
2
answers
36
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 ...