You need to sign in to do that
Don't have an account?

System.NullPointerException: Argument cannot be null.
I am getting null value in my object but dont know why .
mail class:
public class ReportVariables{
HomeEvaluation__c obj = new HomeEvaluation__c();
public Decimal MaxHealth =0 ;
public Decimal Healthandcomfort(Integer Hea,Integer Maxvalue,Decimal CurrentMax){
Id pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
If(Hea==0)
{
MaxHealth = obj.Max_Health_and_comfort__c;
obj.Max_Health_and_comfort__c= MaxHealth;
update obj;
return MaxHealth;
}
else{
MaxHealth = Maxvalue + obj.Max_Health_and_comfort__c ;
obj.Max_Health_and_comfort__c = MaxHealth;
update obj;
return MaxHealth;
}
}
Calling this class on pagereference but i am getting null value eventhough i am assiging some value before calling the class.
page reference
pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
obj.Ventilation_Ducting__c = Ducting;
obj.Ducting_Notes__c=DuctingNotes;
obj.Max_Health_and_comfort__c=0;
update obj;
Repobj.Healthandcomfort(Ducting,6,0);
DuctingReportvalue = 2 * Ducting;
On the second page reference i need to used old value saved in the record. getting same error that time also.:
pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
obj.Ventilation_Filters_Photo_air_condit__c = Filters;
obj.Filter_Notes__c=FilterNotes;
update obj;
FilterMax = obj.Max_Health_and_comfort__c;
Repobj.Healthandcomfort(Filters,9,FilterMax);
FiltersReportvalue = 3 * Filters;
please help me out
mail class:
public class ReportVariables{
HomeEvaluation__c obj = new HomeEvaluation__c();
public Decimal MaxHealth =0 ;
public Decimal Healthandcomfort(Integer Hea,Integer Maxvalue,Decimal CurrentMax){
Id pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
If(Hea==0)
{
MaxHealth = obj.Max_Health_and_comfort__c;
obj.Max_Health_and_comfort__c= MaxHealth;
update obj;
return MaxHealth;
}
else{
MaxHealth = Maxvalue + obj.Max_Health_and_comfort__c ;
obj.Max_Health_and_comfort__c = MaxHealth;
update obj;
return MaxHealth;
}
}
Calling this class on pagereference but i am getting null value eventhough i am assiging some value before calling the class.
page reference
pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
obj.Ventilation_Ducting__c = Ducting;
obj.Ducting_Notes__c=DuctingNotes;
obj.Max_Health_and_comfort__c=0;
update obj;
Repobj.Healthandcomfort(Ducting,6,0);
DuctingReportvalue = 2 * Ducting;
On the second page reference i need to used old value saved in the record. getting same error that time also.:
pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
obj.Ventilation_Filters_Photo_air_condit__c = Filters;
obj.Filter_Notes__c=FilterNotes;
update obj;
FilterMax = obj.Max_Health_and_comfort__c;
Repobj.Healthandcomfort(Filters,9,FilterMax);
FiltersReportvalue = 3 * Filters;
please help me out
Repobj.Healthandcomfort(Ducting,6,0);
you are facing a null with Ducting and the method is expecting a integer value try replacing it with some integer number if Ducting is null.
When i go to first page to second value will be 6 , but if i am tring to recall it by using obj.Max_Health_and_comfort__c i am getting null,
so there wont be null value at any time because even at start i am giving 0 value.
I dont know what i am doing wrong , not able to understand why i am not getting value that is in the record