I've also triedList<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS LIMIT 1];
announcement.parentId = chatterGroups[0].Id;
announcement.parentId = [SELECT Id FROM CollaborationGroup WHERE Name = :constants.INVENTORY_ANNOUNCEMENTS][0].Id;
Has anyone faced this error? How did you build the query?
2 个回答
I figured this out....I hadn't realised that the query was prebuilt as a static list at the beginning of the class. THAT is the query that needs to use the constant. I was building my own query. I've passed the challenge static List<CollaborationGroup> COLLABORATION_GROUP = [
SELECT Id
FROM CollaborationGroup
WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS
OR Name = :('TEST'+Constants.INVENTORY_ANNOUNCEMENTS)
LIMIT 1
];