Here’s a nifty little nugget I discovered today. Credit goes to DXC’s Sébastien Martin for highlighting this on a LinkedIn post. For records that have a hierarchy linked by a parent field, there is a formatter that can display a clickable series of breadcrumbs on the form to show the set of records that form that hierarchy:

In order to utilise this, simply go to the formatters module from the navigator and then search from the available formatters for the ‘Parent Breadcrumbs’ formatter on the Task table. Simply make a duplicate of this record and attach it to the cmn_location table.
Next, return to your location table and edit the form. Add your new formatter to the top of the form ensuring it is in a full-width container and hey presto, a clickable series of breadcrumbs for the parent hierarchy is revealed. Nice and simple.
This little nugget will also work for any other table which has a hierarchic relationship via the parent field.
The breadcrumb formatter is controlled via two records, both of which are held in-platform, so if you need to modify or extend the functionality for other fields and tables you can do so. You’ll need to look at the following:
- The Script Include ‘ParentCrumbs’. This script is what builds the contents of the breadcrumbs. Probably the safest method of extending this for yourself is to insert a new Script Include record which inherits from this baseline, then override the parts that you need. You’ll specifically want to look at the getCrumbs() method for your own purposes.
- The UI Macro ‘parent_crumbs’ will need to be copied and modified to change all references to ${ref_parent}.parent to ${ref_parent}.<your new parent field name>
As a further aside, it doesn’t appear that any of this will work within a scoped application, so if you’re building scoped apps, then you’ll need to roll your own. Specifically, it seems that the following Jelly doesn’t resolve correctly within a scoped app:
<j2:if test="$[!${ref_parent}.isNewRecord() ${AND} !${ref_parent}.parent.nil() ${AND} ${ref_parent}.parent.getRefRecord().isValidRecord()]">
Whilst the value of ${ref_parent} appears to be set correctly to the name of the scoped table, ServiceNow is unable to actually evaluate this and thus execute the relevant APIs against the GlideRecord.
Because the sweeter the cake, the more bitter the jelly can be
Lady Gaga