You need to sign in to do that
Don't have an account?
Jay Weerappulige
Lightning Chart error - Something has gone wrong. Invalid conversion from runtime type EnrolmentsPerYearAuraController to docmCharts.IDOCMDataProvider . Please try again.
I am trying to use App Exchange 'Docmation' for setting a bar chart for my communities. I get thie error when I try to entr the Apex class on the lightning setup page.
My apex class for the extract of data
global class EnrolmentsPerYearAuraController {
@AuraEnabled
global static List<EnrolmentQueryResults> getEnrolmentsPerYear(){
//Get looged in user details
User loggedInUser = [SELECT Id,
ContactId,
Contact.AccountId,
Contact.Company_Contact__c
FROM User
WHERE ID=: UserInfo.getUserId() LIMIT 1];
System.debug('=loggedInUser===='+loggedInUser);
List<AggregateResult> agrResults = [SELECT CALENDAR_YEAR(Start_date__c) startYear,
Count(Id) total
FROM Training_Agreement__c
WHERE CALENDAR_YEAR(Start_date__c) >2011 AND
(Status__c != NULL OR Non_TEC_Funded_Status__c != NULL) AND
//(Company__c = 'CityFitness HO'OR parent_Company_for_community__c ='CityFitness HO')
(Company_Id__c = :loggedInUser.contact.AccountId OR
Parent_Company_ID_for_Community__c = :loggedInUser.contact.AccountId)
GROUP BY CALENDAR_YEAR(Start_date__c)
ORDER By CALENDAR_YEAR(Start_date__c)];
List<EnrolmentQueryResults> aqResults = new List<EnrolmentQueryResults>();
for (AggregateResult ar: agrResults){
aqResults.add(new EnrolmentQueryResults(ar));
}
if (loggedInUser.Contact.Company_Contact__c == TRUE) {
return aqResults;
} else return NULL;
}
}
global class EnrolmentQueryResults {
@AuraEnabled
public Integer Year {get; set;}
@AuraEnabled
public Integer Total {get; set;}
//constructor
global EnrolmentQueryResults(AggregateResult ar){
Year = (Integer)ar.get('StartYear');
Total = (Integer)ar.get('total');
}
}
Thanks in advance for any help
Jay
My apex class for the extract of data
global class EnrolmentsPerYearAuraController {
@AuraEnabled
global static List<EnrolmentQueryResults> getEnrolmentsPerYear(){
//Get looged in user details
User loggedInUser = [SELECT Id,
ContactId,
Contact.AccountId,
Contact.Company_Contact__c
FROM User
WHERE ID=: UserInfo.getUserId() LIMIT 1];
System.debug('=loggedInUser===='+loggedInUser);
List<AggregateResult> agrResults = [SELECT CALENDAR_YEAR(Start_date__c) startYear,
Count(Id) total
FROM Training_Agreement__c
WHERE CALENDAR_YEAR(Start_date__c) >2011 AND
(Status__c != NULL OR Non_TEC_Funded_Status__c != NULL) AND
//(Company__c = 'CityFitness HO'OR parent_Company_for_community__c ='CityFitness HO')
(Company_Id__c = :loggedInUser.contact.AccountId OR
Parent_Company_ID_for_Community__c = :loggedInUser.contact.AccountId)
GROUP BY CALENDAR_YEAR(Start_date__c)
ORDER By CALENDAR_YEAR(Start_date__c)];
List<EnrolmentQueryResults> aqResults = new List<EnrolmentQueryResults>();
for (AggregateResult ar: agrResults){
aqResults.add(new EnrolmentQueryResults(ar));
}
if (loggedInUser.Contact.Company_Contact__c == TRUE) {
return aqResults;
} else return NULL;
}
}
global class EnrolmentQueryResults {
@AuraEnabled
public Integer Year {get; set;}
@AuraEnabled
public Integer Total {get; set;}
//constructor
global EnrolmentQueryResults(AggregateResult ar){
Year = (Integer)ar.get('StartYear');
Total = (Integer)ar.get('total');
}
}
Thanks in advance for any help
Jay