Skip to content

Instantly share code, notes, and snippets.

@icerge
Last active January 2, 2019 10:49
Show Gist options
  • Save icerge/1a0ce22241f434c2d68e356839a70bf1 to your computer and use it in GitHub Desktop.
Save icerge/1a0ce22241f434c2d68e356839a70bf1 to your computer and use it in GitHub Desktop.
Unsuccessful GlideRecord operations: failed insert, failed update, failed delete.

I used to believe my operations are successful. Well, it's not a bullet proof.

var x = new GlideRecord('incident');
var sys_id = x.insert();

sys_id;
// GUID 

x.isActionAborted()
// false of true (e.g. if Data Policy exception)

x.isValidRecord();
// true or false (e.g. if insert failed)

x.getLastErrorMessage()
// string of error message occured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment