Scoped GlideRecord - getLink(Boolean noStack)

Retrieves a link to the current record.

gr = new GlideRecord('incident');
gr.addActiveQuery();
gr.addQuery("priority", 1);
gr.query();
gr.next()
gs.info(gs.getProperty('glide.servlet.uri') + gr.getLink(false));

Output: <BaseURL>/incident.do?sys_id=9d385017c611228701d22104cc95c371&sysparm_stack=incident_list.do?sysparm_query=active=true