sandeep kumar 140

System.NullPointerException: Argument cannot be null

Hi all,

Below is my code.

If(mbd.Score__c >=600 && mbd.Score__c<650){
}else if(mbd.Score__c >=650 && mbd.Score__c<700){
}else if(mbd.Score__c>=700 && mbd.Score__c<750){
}else if(mbd.Score__c>=750){
}else if(mbd.Score__c==-1){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c == 5){
}
if(mbd.Score__c >=700 && mbd.Score__c<750){
}else if(mbd.Score__c >=750){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c==5){
}
}
}
// Calculating Proposed EMI

At Proposed EMI am getting Zero(0) even i have all the field values. What is the problem please let me know.

Thanks
Prem Anandh 1
Hi Sandeep,

{
If()
{
}
else if
{
}
.
.
.
}

Shaijan Thomas
print the below values before calculation

once you get the values use calculator to calculate
Thanks
Prem Anandh 1
What is the exact issue? As per my understanding its Null pointer exception. Can you please elaborate this?
mayur
You are tring to get value from empty list. use below code:
If(mbd.Score__c >=600 && mbd.Score__c<650){
}else if(mbd.Score__c >=650 && mbd.Score__c<700){
}else if(mbd.Score__c>=700 && mbd.Score__c<750){
}else if(mbd.Score__c>=750){
}else if(mbd.Score__c==-1){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c == 5){
}
}
if(mbd.Score__c >=700 && mbd.Score__c<750){
}else if(mbd.Score__c >=750){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c==5){
}
}

// Calculating Proposed EMI
}

VIVEK 998
Hi Sandeep,
You are accesing the list which is either not instantiated or must have been querying zero records.
So for instance you can put both the conditions check :

If(mbd.Score__c >=600 && mbd.Score__c<650){
}else if(mbd.Score__c >=650 && mbd.Score__c<700){
}else if(mbd.Score__c>=700 && mbd.Score__c<750){
}else if(mbd.Score__c>=750){
}else if(mbd.Score__c==-1){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c == 5){
}
}
if(mbd.Score__c >=700 && mbd.Score__c<750){
}else if(mbd.Score__c >=750){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c==5){
}
}

// Calculating Proposed EMI
}

Mark as answer if you find correct.
Thanks!
sandeep kumar 140
Hi all,

I have tried the same but facing same issue. Below is my code.

//system.debug('list'+conList);
Multibureau_Data__c mbd = [select id, Name, Score__c,Contact__c from Multibureau_Data__c where Contact__c=:conList[0].id];
//system.debug('data---'+mbd);
//Loop through all records in the Trigger.newmap collection
for(contact con : conList ){
rid = con.id ;
//Instantiate Class
// MultibureauRequest mr = new  MultibureauRequest();
// mr.m1(rid);
// CIBILConnection C1 = new CIBILConnection(); // instantiate Class
CIBILConnection.CIBILConnection(rid);
}
// Calculating Interest Rate Based on Sector and Score
If(mbd.Score__c >=600 && mbd.Score__c<650){
}else if(mbd.Score__c >=650 && mbd.Score__c<700){
}else if(mbd.Score__c>=700 && mbd.Score__c<750){
}else if(mbd.Score__c>=750){
}else if(mbd.Score__c==-1){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c == 5){
}
if(mbd.Score__c >=700 && mbd.Score__c<750){
}else if(mbd.Score__c >=750){
}else if(mbd.Score__c==4){
}else if(mbd.Score__c==5){
}
}
}
//  update conList;
// Calculating Proposed EMI