You need to sign in to do that
Don't have an account?
sfdc007
Attempt to de-reference a null object
Hi,
I have vf page and apex class where i am tracking the ols sub status value and new substatus in vf page
when i open my vf page i am getting the below error
Attempt to de-reference a null object
An unexpected error has occurred. Your development organization has been notified.
MY VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" mode="inlineEdit" >
<apex:repeat value="{!gpsTeamForm}" var="gps" >
<apex:outputText title="Initial sub-status :" value="{!gps.OldValue}"/>
<apex:outputText title="New sub-status :" value="{!gps.NewValue}"/>
<apex:outputText title="Cycle Time :" />
</apex:repeat>
</apex:pageblock>
</apex:form>
</apex:page>
MY Apex class :
public class CycleTimeSubstatusCalulation{
public List<Team_Form__History> gpsTeamForm {get;set;}
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
Team_Form__c tf = (Team_Form__c) controller.getRecord();
list<Team_Form__History > tempList = [SELECT Id, CreatedDate, Field, NewValue, OldValue, ParentId
FROM Team_Form__History
WHERE ParentId = :tf.Id
AND Field = 'SubStatus__c'];
if(tempList .size()>0)
for(integer i=0; i<tempList.size(); i++ )
{
gpsTeamForm.add(tempList[i]);
}
//gpsTeamForm = tempList[0];
else
gpsTeamForm = new Team_Form__History();
}
}
Hellp me what i am doing wrong here
Thanks in Advance
I have vf page and apex class where i am tracking the ols sub status value and new substatus in vf page
when i open my vf page i am getting the below error
Attempt to de-reference a null object
An unexpected error has occurred. Your development organization has been notified.
MY VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" mode="inlineEdit" >
<apex:repeat value="{!gpsTeamForm}" var="gps" >
<apex:outputText title="Initial sub-status :" value="{!gps.OldValue}"/>
<apex:outputText title="New sub-status :" value="{!gps.NewValue}"/>
<apex:outputText title="Cycle Time :" />
</apex:repeat>
</apex:pageblock>
</apex:form>
</apex:page>
MY Apex class :
public class CycleTimeSubstatusCalulation{
public List<Team_Form__History> gpsTeamForm {get;set;}
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
Team_Form__c tf = (Team_Form__c) controller.getRecord();
list<Team_Form__History > tempList = [SELECT Id, CreatedDate, Field, NewValue, OldValue, ParentId
FROM Team_Form__History
WHERE ParentId = :tf.Id
AND Field = 'SubStatus__c'];
if(tempList .size()>0)
for(integer i=0; i<tempList.size(); i++ )
{
gpsTeamForm.add(tempList[i]);
}
//gpsTeamForm = tempList[0];
else
gpsTeamForm = new Team_Form__History();
}
}
Hellp me what i am doing wrong here
Thanks in Advance
As a best practise we should always initalize all our variables before using them on page side and class side...Please initalize all you rvariables in constructor....
Please check and let me know if it helps you..
Thanks,
Sandeep
All Answers
As a best practise we should always initalize all our variables before using them on page side and class side...Please initalize all you rvariables in constructor....
Please check and let me know if it helps you..
Thanks,
Sandeep