Checking for Users and Groups Based on Grouper

Verify a User Exists in Frevvo

This rule is not yet supported in the Visual Rules Builder and thus still requires some JavaScript. This rule executes when the user enters a value into the User name text field. It uses the built-in isUniqueUserId() method that returns false if the user already exists. If the user already exists this rule then sets the value of a message control, makes that message control visible on the form and sets the Username valid property to false so that Username field displays as invalid to guide the user to make a correction. See the section on dynamic content for more details.

if (U.value.length > 0) { 
    if (frevvo.isUniqueUserId(user.value, tenant.value) === false) {
        M.value = 'User: ' + U.value + ' already exists';
        M.visible = true;
        U.valid = false;
    else {
        M.visible = false;
    }
}

Verify a Role Exists in Frevvo

This rule executes if there is a value in a field named role. It uses the built-in isUniqueRoleId() method that returns false if the role already exists. If the role already exists, this rule displays the message “The role (rolename) already exists in the tenant (tenant name).” to notify the user.

// Verify that a role already exists in the tenant
if(role.value.length > 0)
{
  t.value = frevvo.isUniqueRoleId(role.value, tenant.value);
  if (frevvo.isUniqueRoleId(role.value, tenant.value) === false) {
    ErrMsg.value = 'The role ' + role.value + ' already exists in tenant ' + tenant.value;
  }
}