You need to sign in to do that
Don't have an account?

There was an unexpected error in your org which is preventing this assessment check from completing: System.ListException: List index out of bounds: 0
Hi,
I got the above error while trying to "Create an Indicator Badge Apex Service "
And the code of INDICATOR_Controller shown as below
public class INDICATOR_Controller {
private static SObject sobj;
@AuraEnabled
public static String getSObjectLabel(String sObjName){
String label = Schema.getGlobalDescribe().get(sObjName).getDescribe().getLabel();
return label;
}
@AuraEnabled
public static List<INDICATOR_Service.Indicator> getIndicators(String recId, String objectName){
getSObject(recId, objectName);
if(sobj != NULL){
List<INDICATOR_Service.Indicator> indicators = INDICATOR_Service.getIndicatorBadgesForObject(sobj);
return indicators;
} else{
return null;
}
}
public static void getSObject(String recId, String objectName){
List<String> fNames = INDICATOR_Service.getFieldsToQueryForObject(objectName);
if(fNames.size() > 0){
String query = 'SELECT Id,'+ String.join(fNames,',')+' FROM '+ objectName +' WHERE Id =\''+ recId +'\' LIMIT 1';
List<SObject> results = Database.query(query);
if(results.size() == 1){
sobj = results[0];
}
}
}
}
Please Help!
Thanks,
Sneha M.
I got the above error while trying to "Create an Indicator Badge Apex Service "
And the code of INDICATOR_Controller shown as below
public class INDICATOR_Controller {
private static SObject sobj;
@AuraEnabled
public static String getSObjectLabel(String sObjName){
String label = Schema.getGlobalDescribe().get(sObjName).getDescribe().getLabel();
return label;
}
@AuraEnabled
public static List<INDICATOR_Service.Indicator> getIndicators(String recId, String objectName){
getSObject(recId, objectName);
if(sobj != NULL){
List<INDICATOR_Service.Indicator> indicators = INDICATOR_Service.getIndicatorBadgesForObject(sobj);
return indicators;
} else{
return null;
}
}
public static void getSObject(String recId, String objectName){
List<String> fNames = INDICATOR_Service.getFieldsToQueryForObject(objectName);
if(fNames.size() > 0){
String query = 'SELECT Id,'+ String.join(fNames,',')+' FROM '+ objectName +' WHERE Id =\''+ recId +'\' LIMIT 1';
List<SObject> results = Database.query(query);
if(results.size() == 1){
sobj = results[0];
}
}
}
}
Please Help!
Thanks,
Sneha M.
Your query is not satisfying your condition. better you try to write the query in try(), catch() block.
Warm Regards
Nabeel,
I edited the Visualforce page LoadZBSData and just added an alert where it is setting the dates. I saved it and ran it, and lo and behold, after it showed my alert it actually worked and gave me the success alert that I hadn't seen before. Now I have all the data needed to see the component working in all it's glory!
I have no idea why this worked.
My problem is we have no indication for this isssue in the trail's content
thk
Please do this then Verify step.
Please like this if it works for you.