GlideRecordUtil - mergeToGR(Object hashMap, GlideRecord gr, Object ignore)

Sets the fields in the specified GlideRecord with the field values contained in the specified hashmap, unless that field name is in the ignore hashmap.

Table 1. Parameters
Name Type Description
hashMap Object An Object instance (being used as a hashmap), with properties named for fields and containing the fields' value.
GlideRecord GR The GlideRecord instance to receive the field values.
ignore Object An optional hashmap of field names to ignore.
Table 2. Returns
Type Description

This example updates a computer record's name and os fields, but does not update the sys_created_by field:

var gr = new GlideRecordUtil().getGR("cmdb_ci_computer", "2dfd7c8437201000deeabfc8bcbe5d56");   
var obj = {"name": "xyz", "os": "windows 2000", "sys_created_by", "aleck.lin"};
var ignore = {"sys_created_by": true};
new GlideRecordUtil().mergeToGR(obj, gr, ignore);