You need to sign in to do that
Don't have an account?
Paul 32
Trying to return values for 3 picklist values from custom object in apex class
Hi, I am trying to return the picklist values from 3 picklists from a custom object. So far i can return the values from 1 picklist which i use to populate a lightning:select field in my component, but can i get the other 2 picklists in the same call, or do i have to get them seperatly?
check following post :
http://sfdcmonkey.com/2016/12/05/how-to-fetch-picklist-value-from-sobject-and-set-in-uiinputselect/
for fetch 3 picklist values you just need to update in doInit funtion of above post like this :
doInit: function(component, event, helper) {
helper.fetchPickListVal(component, 'firstFieldAPI__c', 'auraIdOne');
helper.fetchPickListVal(component, 'secondFieldAPI__c', 'auraIdTwo');
helper.fetchPickListVal(component, 'ThirdFieldAPI__c', 'auraIdThree');
},
Regards
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find a post helpful and it answers your question, please mark it as an "Best Answer"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
All Answers
You can achieve this thing in a single call by using Dynamic Apex. Please use below code to get Picklist Values in a single call, You need to change Object Name and Field name in the code: Please mark as best answer if helped.
Regards,
Ramakant
Thanks for the response, but your example only returns the picklist values for the field specified, so in yor example it returns the values for Country__c. What i want to do is return the picklist values for 3 picklists which are Region__c, Status__c, Stage__c.
Thanks,
Paul
I thing you need seperate calls for 3 different picklist fields.
Regards,
Ramakant
check following post :
http://sfdcmonkey.com/2016/12/05/how-to-fetch-picklist-value-from-sobject-and-set-in-uiinputselect/
for fetch 3 picklist values you just need to update in doInit funtion of above post like this :
doInit: function(component, event, helper) {
helper.fetchPickListVal(component, 'firstFieldAPI__c', 'auraIdOne');
helper.fetchPickListVal(component, 'secondFieldAPI__c', 'auraIdTwo');
helper.fetchPickListVal(component, 'ThirdFieldAPI__c', 'auraIdThree');
},
Regards
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find a post helpful and it answers your question, please mark it as an "Best Answer"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.