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
sssssssssssssssssssssss ssssssssssssssssssssssss s 

Make multi-select picklist dependent on single select picklist?

Hi Team,

I have requirement to make multi-select picklist dependent on single select picklist & the only when a certain value of single select picklist is select should the multi-select picklist be enabled.

Can this be achieved using out of the box feature?

Many Thanks in advance for all your help and support!
Deepali KulshresthaDeepali Kulshrestha
Hi, 

Follow this piece of code ,it will as per your condition

When first picklist value get selected than only user can select value from 2nd picklist.  

Component :
<aura:component>

        <aura:attribute name="check" type="String"/>
        <aura:attribute name="currOptions" type="List" />
        <aura:attribute name="newOptions" type="List" />
        <aura:attribute name="selectedValue" type="String" />

        <lightning:select aura:id="distance" label="Distance ?" onchange="{!c.onChange}">
            <option value="10km">10</option>
            <option value="25km">25</option>
            <option value="50km">50</option>
            <option value="100km">100</option>
        </lightning:select>
        
        <div class="slds-m-around_xx-large">
        <lightning:dualListbox aura:id="selectGenre"
                               disabled="{!v.check}"
                               name="Genre"
                               label="Select Genre"
                               sourceLabel="Available Genre"
                               selectedLabel="Selected Genre"
                               options="{!v.GenreList }"
                               value="{!v.selectedGenreList}"
                               onchange="{!c.handleGenreChange}"/>
        <lightning:button variant="brand" label="Get Selected Genre" onclick="{!c.getSelectedGenre}" />
    </div>
        
</aura:component>

Controller :

    onChange : function(c ,e ,h){
    console.log('--------Inside OnChange function---- ');

      let value02 = c.find('distance').get('v.value');
      console.log(' value02'+value02);

          if(value02 != null){
          console.log('Inside If cond  ');
          c.set('v.check',false);
          }else{
          console.log('Value is Null');
          }

    }

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.