August 2017
Intermediate to advanced
1330 pages
56h 17m
English
Here, we use update() to modify a single record:
var ritmGR = new GlideRecord('sc_req_item'); ritmGR.get('number', 'RITM0010455'); ritmGR.setValue('assigned_to', gs.getUserID()); ritmGR.update();
In the following example we will demonstrate the updateMultiple() method by assigning one user (stored in the assignee variable) to all unassigned Incident tickets:
var gr = new GlideRecord('incident'); gr.addNullQuery('assigned_to'); gr.query(); gr.setValue('assigned_to', assignee); gr.updateMultiple();
Note that we don't use the next() method here at all, because we're using the updateMultiple() method. We are also sure to use setValue(), rather than directly setting the value as a property.
Read now
Unlock full access