How to add Breadcrumbs on Incident table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 03:53 AM
Hi Team,
How to add Breadcrumbs on Incident table? Actually I need breadcrumb on incident table, the parent table is Intake (ticket)
TKT0012345 > INC0012345
For this we need to create the following scripts:
1) UI Formatter (Incident Parent Breadcrumbs)
2) UI Macro (intake_parent_crumbs: By using OOB UI macro I've updated the script):
<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j2:if test="$[!${ref_parent}.isNewRecord() ${AND} !${ref_parent}.parent.nil()]">
<g2:evaluate var="jvar_crumbs">
//get real glide record
var gr = new GlideRecord(${ref_parent}.getTableName());
gr.get(${ref_parent}.getUniqueValue());
//parent crumb functions - script include
var pc = new IncidentParentCrumbs(gr);
var crumbs = pc.getCrumbs();
crumbs;
</g2:evaluate>
<j2:if test="$[!jvar_crumbs.nil()]">
<td class="breadcrumb_container">
<g2:no_escape>
${gs.getMessage("Parents")}: $[jvar_crumbs]
</g2:no_escape>
</td>
</j2:if>
</j2:if>
</j:jelly>
****************************************************************************************************
3) Script Include (IncidentParentCrumbs):
/*
* Called from incident Parent Breadcrumbs formatter via the intake_parent_crumbs ui macro.
* Used to show the hierarchy of parent records.
*/
var IncidentParentCrumbs = Class.create();
IncidentParentCrumbs.prototype = Object.extendsObject(ParentCrumbs, {
/**
* get the breadcrumb string with html formatting
*/
getCrumbs: function() {
if (!this.child || !this.child.isValidRecord()) {
return;
}
if (!this._hasValidParent(this.child)) {
return;
}
this._addCrumb(this.child, false);
this._buildParentCrumb(this.child);
return this.crumbs;
},
_buildParentCrumb: function(gr) {
var parent = this._getParent(gr);
this._addCrumb(parent, true);
if (this._hasValidParent(parent)) {
//check for parent limit
if (this.limitCounter >= this.limit) {
gs.log("IncidentParentCrumbs - parent count limit (" + this.limit + " reached while processing: " + this.child.getDisplayValue());
this._addTooManyParentsInfo();
return;
}
//check for recursion
if (this.recordsSeen[parent.getUniqueValue()]) {
gs.log("IncidentParentCrumbs parent recursion found while processing: " + this.child.getDisplayValue());
return;
}
//track parents processed
this.recordsSeen[parent.getUniqueValue()] = true;
//increment counter
this.limitCounter++;
//process the parent
this._buildParentCrumb(parent);
}
},
_getParentField: function(gr) {
return (gr.getTableName() == "incident" ? "intake" : "parent");
},
_hasValidParent: function(gr) {
return JSUtil.notNil(gr.getValue(this._getParentField(gr)));
},
_getParent: function(gr) {
return gr[this._getParentField(gr)].getRefRecord();
},
type: "IncidentParentCrumbs"
});
But, I'm getting following error on Incident form:
Please help on this issue, and let me know if any issues

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 04:03 AM
Hey,
You want create FILTERs?
If yes, then goto System Definition -> Filters
Create New Filters for INCIDENT TABLE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 04:40 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 05:16 AM