Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

124
Visualizações
Error Updating a Chromebook's Organizational Unit with Google Script

I have been experiencing an issue recently with a Google Script code I wrote to update a few Chromebooks' organization units.

Here is a portion of the code that I am running:

let admin = AdminDirectory.Chromeosdevices.get("my_customer", active_deviceid[serial_index])
admin.annotatedAssetId = device_ID.toString()
admin.annotatedLocation = name
admin.orgUnitPath = _location_(device_ID).toString().toUpperCase()

AdminDirectory.Chromeosdevices.update(admin, 'my_customer', active_deviceid[serial_index])

Once the script executes I get the following error:

GoogleJsonResponseException: API call to directory.chromeosdevices.update failed with error: Invalid Input: Inconsistent Orgunit id and path in request - 11006550017573025, /1 SCHOOLS/COVID LOANERS

What is strange is that if I comment or remove "admin.orgUnitPath = location(device_ID).toString().toUpperCase()" the script will run fine. It seems the orgUnitPath is causing this error.

I tried the following:

  1. Removing the first slash "/"
  2. Do only 1 Chromebook
  3. Remove and reapply the AdminDirectory
  4. Run previous scripts that were used to change the OrgUnitPath
  5. Added quotes on the beginning and end of the OrgUnitPath
  6. Converted the path to String with toString()
  7. used Stript() function to eliminate any empty spaces

All the above attempts failed to fix this issue. I will also include an image of an error I am getting from a previous script I made that used to work about a year ago that also changes the OrgUnitPath. Google Script same error message from old script that used to work

Does anyone know how to fix this issue?

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

For some reason there has been a change that now requires the orgUnitId in addition to the orgUnitPath.

So before you run AdminDirectory.Chromeosdevices.update you need to obtain the orgUnitId and update that property

var orgUnitPathStr = "/Tech Dept/Storage"
admin.orgUnitId = AdminDirectory.Orgunits.get("my_customer",orgUnitPathStr.substring(1)).orgUnitId;
//substring(1) above removes the first slash in the orgUnitPath, which is required for this method

Credit for hints: https://github.com/taers232c/GAMADV-XTD3/issues/225

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda