You need to sign in to do that
Don't have an account?
Variable doesnot exist
Hi Team,
I have a requirement if Lawn and Garden field is true then the below select option needs to display.
Please help me, it is throwing variable doesnt exist.
private transient List<SelectOption> cacheProductFamilies = null;
global List<SelectOption> productFamilies
{
get {
if (cacheProductFamilies==null){
cacheProductFamilies = newSelectList(false);
cacheProductFamilies.add(new SelectOption('CP','CP'));
cacheProductFamilies.add(new SelectOption('Seeds','Seeds'));
if (Account__r.Lawn_and_Garden_Agent__c==true){
cacheProductFamilies.add(new SelectOption('Lawn and Garden','Lawn and Garden'));
}
}
return cacheProductFamilies;
}
}
global boolean readyForSearch {
get {
return selectedProductFamily!=null;
}
}
Account__r isn't a valid variable name. You probably meant to reference some instance of another record that is loaded on the page, probably through the standard controller. If so, you need this:
global List<SelectOption> productFamilies
{
get {
if (cacheProductFamilies==null){
cacheProductFamilies = newSelectList(false);
cacheProductFamilies.add(new SelectOption('CP','CP'));
cacheProductFamilies.add(new SelectOption('Seeds','Seeds'));
cacheProductFamilies.add(new SelectOption('Lawn and Garden','Lawn and Garden', (!lng.Lawn_and_Garden_Agent__c==true))); // Updated by Naresh_kalahasthi@infosys.com for Lawn and Garden products
}
return cacheProductFamilies;
}
}
global boolean readyForSearch {
get {
return selectedProductFamily!=null;
}
}
Getting Attempt to de-reference a null object at modified line.
where are you setting the lng object?