Update Reference Field in Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2012 06:17 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2012 07:06 AM
Thanks Mark! That worked great!
Mark Didrikson