function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael Alamag 2Michael Alamag 2 

Getting record in CollaborationGroup is not working in URL rewriter

I am using a URL Rewriter for my community site and I just found out these:
In global list<PageReference> generateUrlFor() I can do this query 
                                String gid = internal.getParameters().get('id');
                                //Select the Group Name
                                CollaborationGroup groups = [SELECT Name FROM CollaborationGroup WHERE id =: gid LIMIT 1]; 
But in global PageReference mapRequestUrl() I can't do this query
                               String groupName = path.remove(0).replaceAll('_',' ');
                               //Select the ID of the CollaborationGroup that matches the name from the URL
                               CollaborationGroup colGroup = [SELECT id FROM CollaborationGroup WHERE Name =: groupName LIMIT 1];

Can anyone help me to solve this cause I need to get the colGroup.id and pass it just like this in mapRequestUrl()
return new PageReference(GROUP_VISUALFORCE_PAGE + colgroup.Id);