+ Start a Discussion
Pablo Gonzalez Alvarez 3Pablo Gonzalez Alvarez 3 

Advanced Apex Specialist Superbadge - Step 6

Hi all,

I have completed Step 6 of this super badge and I've confirmed that the functionality works just fine, but I'm getting the following error

Ensure that you modify the COLLABORATION_GROUP query to use the INVENTORY_ANNOUNCEMENTS constant.

In my code, I'm already using this constant to query the chatter group id when building the announcement, in Product2Helper
 
List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup  WHERE Name = :Constants.INVENTORY_ANNOUNCEMENTS LIMIT 1];
            
announcement.parentId = chatterGroups[0].Id;

I've also tried
 
announcement.parentId = [SELECT Id FROM CollaborationGroup  WHERE Name = :constants.INVENTORY_ANNOUNCEMENTS][0].Id;
Has anyone faced this error? How did you build the query? 
 
Best Answer chosen by Pablo Gonzalez Alvarez 3
Pablo Gonzalez Alvarez 3Pablo Gonzalez Alvarez 3
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
    ];

 

All Answers

Pablo Gonzalez Alvarez 3Pablo Gonzalez Alvarez 3
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
    ];

 
This was selected as the best answer
Yashita Goyal 17Yashita Goyal 17
Am unable to achieve code coverage for Product2Helper and AnnouncementQueueable class as announcement are not getting created.

Any help..?