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
KNKKNK 

Select Option Filter values disable on a condition

Hi Team,

 

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'));
                cacheProductFamilies.add(new SelectOption('Lawn and Garden','Lawn and Garden', getdisabled if(Account__r.Lawn_and_Garden_Agent__c="true")));
            }
            return cacheProductFamilies;           
        }
    }
   
    global boolean readyForSearch {
        get {
            return selectedProductFamily!=null;
        }
    }

 

I want to enable the Lawn and Garden option value, if a filed check box is set to true.

 

Could you please help me on this.

Hengky IlawanHengky Ilawan

Hi Naresh,

 

The 3rd param of the SelectOption constructor is type of Boolean, so you need to pass a boolean value:

 

cacheProductFamilies.add(new SelectOption('Lawn and Garden','Lawn and Garden', !Account__r.Lawn_and_Garden_Agent__c));

 

-Hengky-

KNKKNK
cacheProductFamilies.add(new SelectOption('Lawn and Garden','Lawn and Garden', (!Account__r.Lawn_and_Garden_Agent__c )));

Compile Error: Variable doesn't exist..