One of the most powerful methods that I don't see many people using: getRefRecord().
When to use it?
What I usually see people doing it?
var caller = new GlideRecord('sys_user');
if (caller.get(current.caller_id.getUniqueValue())){
caller.active = false;
caller.update();
}
It is not wrong, but it is not efficient when you have e.g. a huge code, or you are building a payload as JSON for an API call. In this specific example above, it might look ok to do so, because it is a few lines of code. But if you had many lines in the between and you needed to update something again, you would probably need to do another GlideRecord...
How to use it? Assume on code below that the BR runs on "incident", so "current" is your Incident Record. You can save this object in a variable once and reuse it as much as you need in your code anytime you need any info.
var caller = current.caller_id.getRefRecord();
caller.active = false; //dot-walk to fields from 'sys_user' table
caller.update();
Advantages: as you saw, it reduces lots of lines of code, complexity and readability.
Use this official ServiceNow KB Article for more infos.
Hope it helps! :-) Happy coding!
Felipe | IT Architect