You need to sign in to do that
Don't have an account?
VijayNi
Unexpected Token - List
Hi Team,
I am doing a traihead challenege of aura component to override standard action but in the apex class i am facing the below error in dynamic apex can you help me out .
Apexcontroller
@AuraEnabled public static List<String> getPickListValuesIntoList(String objectType, String selectedField){ List<String> pickListValuesList = new List<String>(); Schema.SObjectType convertToObj = Schema.getGlobalDescribe().get(objectType); Schema.DescribeSObjectResult res = convertToObj.getDescribe(); Schema.DescribeFieldResult fieldResult = res.fields.getMap().get(selectedField).getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry pickListVal : ple){ pickListValuesList.add(pickListVal.getLabel()); } return pickListValuesList; }
I am doing a traihead challenege of aura component to override standard action but in the apex class i am facing the below error in dynamic apex can you help me out .
Apexcontroller
@AuraEnabled public static List<String> getPickListValuesIntoList(String objectType, String selectedField){ List<String> pickListValuesList = new List<String>(); Schema.SObjectType convertToObj = Schema.getGlobalDescribe().get(objectType); Schema.DescribeSObjectResult res = convertToObj.getDescribe(); Schema.DescribeFieldResult fieldResult = res.fields.getMap().get(selectedField).getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry pickListVal : ple){ pickListValuesList.add(pickListVal.getLabel()); } return pickListValuesList; }
Please make sure you are using an appropriate data type that is supported.
Going forward for all the Certification and Trailhead Guidance please report it here,
https://trailhead.salesforce.com/en/help?support=home
https://trailhead.salesforce.com/help
So that our trailhead support engineers will look into it and get back to you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Regards,
Salesforce Support.