Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!