function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NikunjVadiNikunjVadi 

Getting null value from field

Hey,

I am updating value of Max_Health_and_comfort__c in 1st vf page. Now i want to add some value on the same field in the next vf page. But i am getting null value from the field so i am not able to do addition .

I am using taking pageid from the url , creating object of the custom object obj and than trying to do addition,

HomeEvaluation__c obj = new HomeEvaluation__c();
Id pageid=ApexPages.currentPage().getParameters().get('id');
obj.Id=pageid;
MaxHealth = Maxvalue + obj.Max_Health_and_comfort__c;

On the 4th line i am getting error because i am getting null value in Max_Health_and_comfort__c, eventhough there is some value in the record. 
RamuRamu (Salesforce Developers) 
Problem could be with saving the value of Max_Health_and_comfort__c prior to referring it. Use the get set properties to assign the value first to a controller property and then try to fetch that value again in VF page 2 from the same controller.
NikunjVadiNikunjVadi
Hey Ramu, 

Thanks for the reply. i just need to fetch the value from the record. why i am not able to use that. and controller going to be refreshed when it gets redirected so i dont think it will hold a value.