Make email field mandatory when user creates a new group
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 08:04 AM
How to make the Group email field mandatory when a user creates a new group and has the Admin role.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 11:57 PM
I would suggest do not make email field mandatory on group table instead you can write before insert business rule on group table:
(function executeRule(current, previous /*null when async*/) {
// Check if the current user has the Admin role
var userHasAdminRole = gs.hasRole('admin');
// Check if the Group email field is empty
var groupEmailEmpty = gs.nil(current.email);
if (userHasAdminRole && groupEmailEmpty) {
// Set an error message to inform the user that Group email is mandatory
current.setAbortAction(true);
current.addErrorMessage('Group email is mandatory for Admins when creating a new group.');
}
})(current, previous);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks