unassignRole( )


Unassigns a role from group members.

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.

Method Declaration
Copy
function unassignRole(
  groupId: string,
  memberIds: Array<string>,
  role: GroupRole,
  options: UnassignRoleOptions,
): Promise<UnassignRoleResponse>;
Method Parameters
groupIdstringRequired

Group ID.


memberIdsArray<string>Required

Member IDs.

Max: 100 member IDs


roleGroupRoleRequired

Role to unassign.


optionsUnassignRoleOptions
Returns
Return Type:Promise<UnassignRoleResponse>
JavaScript
import { roles } from "wix-groups.v2"; // Sample ID values: // memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'], // groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.' // // Sample role value: // role: 'MEMBER' // export function unassignRole(groupId, memberIds, role) { return roles .unassignRole(groupId, memberIds, role) .then((response) => { console.log(response); }) .catch((error) => { console.error(error); }); } /* Promise resolves to: * role: "MEMBER" */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?