You need to sign in to do that
Don't have an account?
SF Beginner 2019
Dynamic Picklist in Lightning
How can I store this on a picklist.
is my attribute correct?
this is my apex class to return list
this is my helper
is my attribute correct?
<aura:attribute name="Type" type="String" />
this is my apex class to return list
@AuraEnabled public static List<String> getAuthorized(string recordId){ List<ID> coid = new List<ID>(); List<String> MemName = new List<String>(); for( Member__c covmem : [SELECT Id,Name, FROM Member__c WHERE Account__c =: recordId ] ) { coid.add(covmem.Personel__c); } for(Personel__c cov : [SELECT Id,Name FROM Personel__c WHERE Id =: coid ]){ MemName.add(cov.Name); } return MemName; }
this is my helper
getAuthorized : function(component,event,helper){ var recordId = component.get("v.recordId"); var action = component.get("c.getAuthorized"); action.setParams({recordId : recordId}); action.setCallback(this,function(response){ var state = response.getState(); if(state === "SUCCESS"){ //alert(JSON.stringify(response.getReturnValue())); var coidpicklist = response.getReturnValue(); component.set("v.Type",coidpicklist); //var coidpicklist = response.getReturnValue()[0].ValuePicklist__c; } }); $A.enqueueAction(action); },
Review below working example to get picklist values
https://www.biswajeetsamal.com/blog/get-picklist-values-dynamically-in-lightning-component/
Thanks,
Vinay Kumar
<aura:attribute name="Type" type="String[]" />
or
<aura:attribute name="Type" type="List" />
Check the below link for attribute data types reference:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_attr_types_collection.htm
Thanks,
Maharajan.C