We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Update Reference Field in Script

mdidrikson
Kilo Contributor

Hello,

I would like to update the manufacturer field in the CMDBo to be 'Hewlett-Packard' for all records . This field is a reference field with the following information.

Table: cmdb_ci
Element: manufacturer
Type: reference
Reference: core_company

Here is my script.



var rec = new GlideRecord('cmdb_ci_computer');
rec.query();
while (rec.next()) {
rec.manufacturer = 'Hewlett-Packard'
gs.print('Record Updated ' + rec.manufacturer);
rec.update();
}

gs.print(rec.getRowCount());



Is there a way this update can be run with a script?

Thanks!

Mark Didrikson

5 REPLIES 5

mdidrikson
Kilo Contributor

Thanks Mark! That worked great!

Mark Didrikson