R34577 GroupMember – Only Admin Change Role Not Allowed

Code R34577
Entity Communities.Social.GroupMembers Entity
Name OnlyAdminChangeRoleNotAllowed
Attribute -
Layer Back-End
Events Commit
Record State Updated
Priority Normal
Modify NO
Action if (GroupMember.Role != Admin) AND GroupMember.Role.DatabaseValue == Admin
, then check:

if (Count (GroupMembers, where SocialGroup == GroupMember.SocialGroup && Role == Admin ) <= 1)
, then FAIL
Description If a group member is the only admin of the group, they are not allowed to change their role to a regular member.
Message You cannot demote yourself from admin to regular member because you are the only admin of group '{SocialGroup.DisplayText}'.

There must be at least one admin in the group.
Version Introduced: v.2023
Revocable NO

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.