Blog

Stored Breadcrumbs

How to store the parent breadcrumbs within a ServiceNow table for reporting purposes. This is helpful for exporting table information into excel, in that you can sort on the Breadcrumbs field to determine a planned task’s level and sort Tasks in an appropriate hierarchical order.

“The parent breadcrumbs formatter on the Task table provides breadcrumbs that show the parent or parents of the current task. This formatter can be used on any table that extends Task, as well. Parent breadcrumbs were introduced with June 2011 Preview 2. “

http://wiki.servicenow.com/index.php?title=Task_Parent_Breadcrumbs_Formatter

Stored Breadcrumbs

  1. Dictionary

    Add Breadcrumbs to Task

    • Table: Task

    • Field: u_breadcrumbs

    • Type: String (2000)

    • Label: Parent Breadcrumbs

2. Business Rule

Add Business Rule to set the breadcrumbs value.

  • Name: Set Breadcrumbs

  • When: before

  • Table: Task

  • Insert, Update: true

  • Condition: current.operation() == 'insert' || current.parent.changes() || current.u_breadcrumbs.nil()

  • Script:

    current.u_breadcrumbs = current.getDisplayValue();
    if (!current.parent.nil()) {
    setBreadCrumbs(current.parent);
    }
    function setBreadCrumbs(gr) {
    	current.u_breadcrumbs = gr.getDisplayValue()+ ' > ' + current.u_breadcrumbs;
    	if (!gr.parent.nil()) {
    		setBreadCrumbs(gr.parent);
    	}
    }

3. Results

Example tasks shown below with Parent Breadcrumbs.