I want to enable the sObject picklist field on selection of Type picklist otherwise it's disabled

417 Views Asked by At

As you can see in photo in Type picklist field when i select salesforce sObject only that time i'm able to select Sobject type picklist otherwise it's disabled. enter image description here

like this other filed is selected or none then sObject Picklist field is disabled we can't select it. enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

Just added this on controller

  onChageType:function(component){
    var val = component.get("v.type");
    // console.log('type',val);
    if(val == 'Salesforce sObject'){
        component.set('v.isActive',false);
    }
    else{
        component.set('v.isActive',true);
        component.set("v.selectSojbect",'');
    }
},
0
On

If you are using out of box page layouts and standard edit screen, hiding/disabling a field at runtime is not possible.

However, you can set up the 'Type' picklist field as the controlling field for the 'Select SObject' picklist field. Map the values, such that if the Type is SObject then only it will render the values for SObject picklist.

This is called 'Dependent Picklists' feature.