Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Make email field mandatory when user creates a new group

Payal Tripathy
Tera Contributor

How to make the Group email field mandatory when a user creates a new group and has the Admin role.

5 REPLIES 5

Maddysunil
Kilo Sage

@Payal Tripathy 

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