Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
How to add multiple user attributes in app-script?

I am automating the onboarding process in our organization and have a google form connected with app-script. The user is getting created in google admin but I would like to add more attributes such as Manager's name, Department, phone number etc.

Here is the API method:

var user = {
  "primaryEmail": email,
  "name": {
    "givenName": givenName,
    "familyName": familyName
  },
  "relations": [{
    "value": manager,
    "type": manager,
  }],
  "password": password,
};

console.log(password);

try {
  user = AdminDirectory.Users.insert(user);
  console.log('User %s created with ID %s.', user.primaryEmail, user.id);
} catch (err) {
  console.log('Failed with error %s', err.message);
}

But as of now, there is something wrong with the manager code because I get the following error:

Failed with error API call to directory.users.insert failed with error: Invalid value for: TEST is not a valid value

(For context, I had put in TEST as the manager's value in the form)

Please let me know what I am doing wrong so I can fix this. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After going through the documentation here it states:

"... relations: A list of the user's relationships to other users..."

As for relation value types:

  1. type accepts values:

    admin_assistant, assistant, brother, child, custom, domestic_partner, dotted_line_manager, exec_assistant, father, friend, manager, mother, parent, partner, referred_by, relative, sister, spouse

Custom: Let's you add custom values.

  1. values refer to the person the user is related to. It can be a name or an email address as seen below.

In the onboarding scenario, this can be implemented to specify the manager's email address for this user:

let email = 'GIMMEABREAK@domain.xyz'
let givenName = 'X'
let familyName = 'testOnly'
let password = 'passowerd#$"#$22'


let type = 'manager'
let value = 'yancymelany@domain.xyz'

var user = {
  "primaryEmail": email,
  "name": {
    "givenName": givenName,
    "familyName": familyName
  },
  "relations": [{
    "value": value,
    "type": type,
  }],
  "password": password,
};

And this succeeds:

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda