1

I'm working on a Visualforce page where I want to grab a user's groups and paginate over the list. Getting the groups is pretty straightforward using the ConnectApi's ChatterUsers.getGroups method (example here). What I'm struggling a bit with is why I am getting the following error when I try to create a class level variable of the return type (ConnectApi.UserGroupPage) to hold the data.

Invalid type: ConnectApi.User​​GroupPage (Line: 3, Column: 26)

I did a little experimenting and noticed if I had either a class level variable or return type for a method of ConnectApi.UserGroupPage, I would receive the Invalid type error. However, if I declared a variable locally inside of a method, it had no problem compiling. Any ideas if this is by design?

public with sharing class GroupsController {

    // This line will error
    @TestVisible private ConnectApi.User​​GroupPage groupsUserIsMemberOf;    

    // If I comment out the class-level variable, this line will error
    public ConnectApi.UserGroupPage getGroupsUserIsMemberOf() {
        // Implementation is meaningless for this error
        return null;
    }
}
4

If you use e.g. inspect element in Chrome, you will see that there are a couple of non-rendering Unicode characters between "User" and "GroupPage" in your class level type declaration. Probably picked up cutting and pasting from some documentation.

Key "UserGroupPage" in from scratch and that declaration will compile as you expect.

PS The characters are "ZERO WIDTH SPACE" which are "intended for invisible word separation and for line break control".

0

Not sure if this is by design. Can you return a the same type in a wrapper class and see if that works ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.