.update() does not work and returns null

Yuriy7
Kilo Contributor

Often fails to update the record fields

var req_parent = new GlideRecord('sc_req_item');

req_parent.get(current.request_item.sys_id)

req_parent.state = 3;

// then I try to update the record

var req_id = req_parent.update();

gs.log("##### For " + req_parent.number + " - success. ID of the updated record: " + req_id);

This code does not work in a small number of cases (maybe 1-5%)

In the log, I see this message:

"##### For RITM4756385 - success.  ID of the updated record: null"

Although in most cases I see the return value here - the sys_id of records.

Who faced something similar? What diagnostics can be done to identify the cause?

20 REPLIES 20

Yuriy7
Kilo Contributor

But if the update was hampered by another business - rule, surely its action would be recorded in activity. But I do not see any record there.