Skip to main content

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

Comments

Popular posts from this blog

Search Solution Basics

When is it a good time to create a customized search solution? You're developing an external knowledge base for user support. You're in the mood for a fun Friday night. The sales reps just started using the Sales Cloud in Lightning Experience. You want to put your company branding in the search bar. What differentiates SOSL from SOQL? Syntax SOSL searches the search index instead of the org database. SOSL searches more efficiently when you don't know in which object the data resides. All of the above. SOSL works with: REST only SOAP only REST, SOAP, and Apex SOQL only What does a search for a single object look like in SOSL? FIND {cloud} RETURNING Account FIND in ACCOUNT RETURNING "cloud" FIND "cloud" in ACCOUNT FIND (cloud) RIGHT NOW! What does a search for multiple objects look like in SOSL? FIND {sneakers} RETURNING ALL ARTICLES FIND {sneakers} in ALL OBJECTS FIND {sneakers} RETURNING Product2, Content

Process Builder is not fired when field update is called from Approval Process

Scenario In Final Approvals section ; in Approval Process we have field update to update Status field. In Process Builder , we have some action that need to be done when Status field is updated in Approval Process.However this process builder is not fired. Solution To handle this, in Field Update in Approval Process , check Re-evaluated Workflow Rules after Field Change as picture below. What happen if field updated from Approval Process. Workflow - does not fires untill Re-evaluate workflow checkbox is ticked on your field update Process Builder - does not fires untill Re-evaluate workflow checkbox is ticked on your field update Trigger - will fire if conditions are matched This is explained in article here  . Field Updates That Re-evaluate Workflow Rules If  Re-evaluate Workflow Rules After Field Change  is enabled for a field update action, Salesforce  re-evaluates all workflow rules on the object if the field update results in a change to the value of the fi

Tips and Tricks : Test class for Invocable method

Issue : I got 100% coverage in my sandbox but when run validation for deployment it returns 0% coverage It turn out that in my sandbox, I am depending on Process Builder to Invocable Apex class, as long I manipulate test data that fire Process Builder it will call Invocable class. This is not useful when deploying it to Production although it gets deployed together with Process Builder. The correct way is to direct call Invocable method inside test class itself. Example of class : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 global class MyCustomObject_StatusUpdate_Util { @InvocableMethod ( label = ' Update Quote Status ' ) public static void updateQuote ( Request [] requests ) { Set < Id > setOppId = new Set < Id >(); List < SBQQ__Quote__c > listQuoteToUpdate = new List < SBQQ__Quote__c >(); for ( Request request : requests ) {