Friday, August 14, 2015

Breadcrumb in Gridbuddy

I just get to play around with Gridbuddy.While breaking an ice,I got requirement to create breadcrumb in Gridbuddy,I referring to this site and follow the instruction.But somehow I bumped to some errors and manage to fix it.So I would like to rewrite it here so I won't forget.

This is referring to Account breadcrumb because Account can have many children and grandchildren.

Account A  --> Account B -->Account 1
                   --->Account C -->Account 2
                   --->Account D 

So breakcrumb will be look like this Account A >> Account >> B >> Account 1

These are the steps:

  1. Create a number formula field to indicate hierarchy level at Account object.
  2. Create a text formula field to printout breadcrumb link
  3. Create a text formula field for Drill Up URL
  4. Add formula field to Gridbuddy field
  5. Create two actions at GridBuddy ; Drill Up and Drill Down.
  6. Add action to the Grid

Step 1:Create a number formula field to indicate hierarchy level at Account

Go to Setup >> Customize>>Account and create Custom Field with details below:
Data Type: Formula
Field Name :Hierarchy Level
Formula Return Type :Number
At Advanced Formula, paste this formula:

IF(!ISBLANK(ParentId), 2, 1)+

IF(AND(!ISBLANK(ParentId),!ISBLANK(Parent.ParentId)), 1, 0)+

IF(AND(!ISBLANK(ParentId), !ISBLANK(Parent.ParentId), !ISBLANK(Parent.Parent.ParentId )),1, 0)+

IF(AND(!ISBLANK(ParentId), !ISBLANK(Parent.ParentId), !ISBLANK(Parent.Parent.ParentId ), !ISBLANK(Parent.Parent.Parent.ParentId)), 1, 0)+

IF(AND(!ISBLANK(ParentId), !ISBLANK(Parent.ParentId), !ISBLANK(Parent.Parent.ParentId ), !ISBLANK(Parent.Parent.Parent.ParentId), !ISBLANK(Parent.Parent.Parent.Parent.ParentId)), 1, 0)+

IF(AND(!ISBLANK(ParentId), !ISBLANK(Parent.ParentId), !ISBLANK(Parent.Parent.ParentId), !ISBLANK(Parent.Parent.Parent.ParentId), !ISBLANK(Parent.Parent.Parent.Parent.ParentId), !ISBLANK(Parent.Parent.Parent.Parent.Parent.ParentId)), 1, 0)

Step 2:Create a text formula field to printout breadcrumb link

Go to Setup >> Customize>>Account and create Custom Field with details below:
Data Type: Formula
Field Name :Hierarchy Level
Formula Return Type :Text

At Advanced Formula, paste this formula:

CASE(Hierarchy_Level__c, 
1, "",

2, HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + ParentId, Parent.Name,"_self") + " > ",

3, HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + Parent.ParentId, Parent.Parent.Name,"_self") + " > " + 
HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + ParentId, Parent.Name,"_self") + " > ",

HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + Parent.Parent.ParentId, Parent.Parent.Parent.Name,"_self") + " > " + 
HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + Parent.ParentId, Parent.Parent.Name,"_self") + " > " + 
HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + ParentId, Parent.Name,"_self") + " > ") 

+ HYPERLINK("/apex/gblite__Grid?gname=Account+Hierarchy&fpf=ParentId&fpv=" + Id, Name, "_self")

Note:Account+Hierarchy actually is grid name Account Hierarchy.

Step 3 :Create a text formula field for Drill Up URL

Go to Setup >> Customize>>Account and create Custom Field with details below:
Data Type: Formula
Field Name :Parent Account URL
Formula Return Type :Text
At Advanced Formula, paste this formula:


'/apex/gblite__grid?gname=Account Hierarchy&fpf=Id&fpv=' + Parent.Id

Note:Account Hierarchy is a grid name.

Step 4 :Add formula field to Gridbuddy field

Go to Grid Wizard >> Manage Grid.If haven't create any grid yet, create new Grid named Account Hierarchy.If you want to apply breadcrumb to existing Grid, please ensure in previous steps replace Account Hierarchy with .

After Create or Select the grid, click Next.Select Hierarchy Link field from Parent Object and move it to Selected Fields as below.Then Save.


Step 5: Create two actions at GridBuddy (Drill Up and Drill Down)

In this step, we will create to Action which are Drill Up and Drill Down.
Click Manage Action>>New to create new Action.Below are the details to create the Actions

Drill Up Action


Drill Down Action


Note:Content is Account Hierarchy&fpf=ParentId . Replace Account Hierarchy with your grid name if you use different name.

Step 6 : Add action to the Grid

After Save, you can click Manage Grid to go back to the grid.Select your grid name and Click Next.Scroll down to the bottom until you find Select Action.


Check on Drill Down and Drill Up and Save.So now you can Launch Grid.But for my case,because I embed this grid inside Visualforce.So this is my view.


This entry is adapted from Create breadcrumb with formula field

No comments:

Post a Comment