Trying to build a string with the the parts of a SOQL query. I cant get the syntax right with the Account.name
and Count fields, even tried the alias name
and 'co'.
`List < AggregateResult > AggregateResultList = [SELECT AccountId, Account.Name name, COUNT(Id) co
FROM Case
WHERE CreatedDate = LAST_N_DAYS:7 AND Id in :Trigger.New
GROUP BY Account.Name, AccountId
HAVING COUNT(Id) >= 8
];`
message = 'Account name: ' + string.valueOf(AggregateResultList[0].name) +
' has ' + integer.valueOf(AggregateResultList[0].co)+
' cases opened in the last 8 days.';
I am receiving errors:
Variable does not exist: name
Variable does not exist: co
Thank you in advance.