Search.../

unassignRole( )

Unassigns a role from group members.

Description

Note: This function is only relevant for site admins, and group members with group admin permissions.

The unassignRole() function returns a Promise that resolves to the unassigned role after it has successfully been unassigned. This function only applies to admin roles. Using this function with member roles returns an error.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function unassignRole(groupId: string, memberIds: Array<string>, role: GroupRole): Promise<UnassignRoleResponse>

unassignRole Parameters

NAME
TYPE
DESCRIPTION
groupId
string

Group ID.

memberIds
Array<
string
>

Member IDs.

Max: 100 member IDs

role
GroupRole

Role to unassign.

Returns

Return Type:

Promise<
UnassignRoleResponse
>
NAME
TYPE
DESCRIPTION
groupId
string

Group ID.

memberIds
Array<
string
>

Member IDs.

role
GroupRole

Unassigned role.

Was this helpful?

Unassign a role to a group member

Copy Code
1import { roles } from "wix-groups.v2";
2
3// Sample ID values:
4// memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'],
5// groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.'
6//
7// Sample role value:
8// role: 'MEMBER'
9//
10
11export function unassignRole(groupId, memberIds, role) {
12 return roles.unassignRole(groupId, memberIds, role)
13 .then((response) => {
14 console.log(response);
15 })
16 .catch((error) => {
17 console.error(error);
18 });
19}
20
21/* Promise resolves to:
22 * role: "MEMBER"
23 */