Restrict "Edit Members" Functionality for Non-RM Groups for Users with skill_admin Role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
In DEV instance, I impersonated with the user having 'skill_admin' role and observe that the 'edit' button for adding and removing group members is available for the group whose name starts with "RM" and whose name doesn't start with "RM". We want that the 'edit button should only be visible on the group whose name starts with "RM" and not for any other group, when the user is impersonated with the account having 'skill_admin' role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago - last edited 4 hours ago
Hi @AshishSamuD,
You can add your restriction in edit omit condition.
Right Click on any column in the particular related list (Group Member) you want to add edit restriction > Configure > List Control
Add the following script in edit omit condition:
gs.hasRole('skill_admin') && current.name.indexOf('RM') != 0Save the record.
Alternatively, you can also do abort insert if your condition doesn't match.
on sys_gr_groupmember, create BR with following specs:
- When: Before
- Insert: true
Advanced: true
(function executeRule(current, previous) {
// Only apply this restriction to skill_admin users
if (!gs.hasRole('skill_admin')) {
return;
}
// Get the group associated with this membership
var group = current.group.getRefRecord();
if (!group.isValidRecord()) {
return;
}
// Allow membership creation only for groups starting with RM
if (group.name.indexOf('RM') != 0) {
gs.addErrorMessage('You can only add members to RM groups.');
current.setAbortAction(true);
}
})(current, previous);
Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.
Kind Regards,
Ehab Pilloor
