function validateId(id) {
    if (id && id.trim() && /^[a-zA-Z0-9_]+$/.test(id)) {
      if (agency.isIdInUse(id)) {
        err.name = 'DuplicateIdError';
        err.message = 'duplication (use a different id)'; 
        return err;
      } else {
        return id;
      }
    } else {
      err.name = 'ValidateIdError';
      err.message = 'failed id validation (please use alphanumeric characters and underscore)'; 
      return err;
    }
  }
function validateId(id) {
    if (id && id.trim() && /^[a-zA-Z0-9_]+$/.test(id)) {
      if (agency.isIdInUse(id)) {
        err.name = 'DuplicateIdError';
        err.message = 'duplication (use a different id)'; 
        return err;
      } else {
        return id;
      }
    } else {
      err.name = 'ValidateIdError';
      err.message = 'failed id validation (please use alphanumeric characters and underscore)'; 
      return err;
    }
  }
function validateId ( id ) { if ( id && id . trim ( ) && / ^[a-zA-Z0-9_]+$ / . test ( id ) ) { if ( agency . isIdInUse ( id ) ) { err . name = 'DuplicateIdError' ; err . message = 'duplication (use a different id)' ; return err ; } else { return id ; } } else { err . name = 'ValidateIdError' ; err . message = 'failed id validation (please use alphanumeric characters and underscore)' ; return err ; } }
validates the agent's id according to the validity of the symbols used and the possibility of duplication inside the same agency
validates the agent s id according to the validity of the symbols used and the possibility of duplication inside the same agency