question

Daniel Marques avatar image
Daniel Marques asked

ListGroupMembers in cloudscript returning only 2 members

Hi everyone,

Whenever I try to list all group members in cloud script is always returning only 2 members of a group, even that I have a lot of them already. this cloud script call is asked by the administrator of the group.

var group = { Id: args.groupId, Type: "group" };
    
    try
	{
        var allStudents = entity.ListGroupMembers (
        {
           Group: group
        });
	}
	catch (e)
	{
		var msg = "Error: " + JSON.stringify(e);
		log.info(msg);
		
		return "error";
	}
	
	return allStudents.Members.length;

In client code it returns fine, the issue is only in Cloud Script. Group ID as an example: BEE87EEE53CAE05B

Is this a bug? Am I missing something?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

This is not a bug. The ListGroupMembers API returns roles in the first layer, then under those roles, there will be actual members. Please refer to this API structure. If you change line 18 in your code snippet to “return allStudents.Members;”, you will be able to see the structure of your group.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Daniel Marques avatar image Daniel Marques commented ·

That was it! Thanks! =D

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.