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
Vanitha ManiVanitha Mani 

lightning combobox


Hi,

I have a lightning combobox which displays based on the product field value in case..i have like v.ticket.Product__c..but when the product value gets changed the picklist values are not getting updated..it just shows the old value...can anyone help with this..

<lightning:combobox aura:id="selectItem" fieldName="Feature_Function__c" label="Failure Point"
                        placeholder="Choose Failure Point"
                        value="name"
                        required="true"
                        dropdownAlignment="right"
                        variant="standard"
                        messageWhenValueMissing="Complete this field"
                        onchange="{!c.handleOptionSelected}"
                        options="{!v.featureOptions}"/>

js con:

var productid = component.get("v.ticket.Product__c");
        var action = component.get("c.getFeatureFunction");
        if(productid != 'undefined' && productid !=null){
        action.setParams({
            productId: productid
 
            
        });
       
             action.setCallback(this,function(response){
                 var res = response.getReturnValue();
                 console.log('template object::'+JSON.stringify(response.getReturnValue()));
                 var state = response.getState();
                 if(state == "SUCCESS"){
                     var lables= [];
                     res.forEach(function(key) {
                         lables.push({"label":key.Name ,"value":key.Id});
                         $A.get('e.force:refreshView').fire();
                     });
                    
                     component.set("v.featureOptions", lables);
                     $A.get('e.force:refreshView').fire();
                  
                 }
             });
             $A.enqueueAction(action);
        } 

apex:
@AuraEnabled
     public static List<SVC_Feature_Function__c> getFeatureFunction(String productId){
         
        return [SELECT Id, Name FROM SVC_Feature_Function__c Where Product__c =:productId order by Name asc];
         
    }