Scoped GlideRecord - getUniqueValue()

Gets the primary key of the record, which is usually the sys_id unless otherwise specified.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
String The unique primary key as a String, or null if the key is null.
var gr = new GlideRecord('kb_knowledge');
gr.query();
gr.next();
var uniqueid = gr.getUniqueValue();
gs.info(uniqueid);

Output: