Set Up GRAX Search

Let's walk through how to set up a custom GRAX Search component in order to find and restore specific records.

Configure Page Layout

📘

Salesforce Classic vs Lightning.

The configuration section is divided into two sections: Classic and Lightning. Please follow the instructions that coincides with your environment.

Lightning

  1. Go to your Salesforce environment where you have installed the GRAX Application (Lightning Environment).
  2. Go the page where you would like to update the page layout and select the gear in the top right corner and then Edit Page.
  3. Click on the list of tabs and click Add tab and give it an appropriate name.
    a. Our recommendation is to name the tab “Restore”.
  4. Click on the tab and from the left drag on Lightning Component Visualforce.
  5. Set the options as below:
    a. Visualforce Page Name: Grax Restore
    b. Height: We recommend 700, but use your discretion
  6. Click Save and make sure that the page has been “Activated”.
  7. You should now see a tab for “Restore”.

Classic

  1. Go to your Salesforce environment where you have installed the GRAX Application (Classic Environment)
  2. Once logged in, click the Setup button at the top right.
  3. In the Quick Find / Search search box (top left) type Visualforce and select Visualforce Pages from the menu.
  4. Select New to create a new VisualForce page.
  5. In the label and name fields enter GRAX Restore and paste the following code into the Visualforce Markup. Please make modifications to the code per your use case and click Save:

The following example will display related records of Case and Contacts on the Account object.

<apex:page standardController="Account" showHeader="false" sidebar="false">
    <apex:variable var="recordId" value="{!account.id}" />
    <apex:variable var="recordName" value="{!account.name}" />
    <apex:variable var="objectName" value="Case" />
    <apex:variable var="fieldsToDisplay" value="Subject,CreatedDate,Status" />
    <apex:variable var="queryFilter" value="" />
    <apex:variable var="showPreviewButton" value="true"/>
    <apex:variable var="displayRestoreInfoSwitch" value="true"/>
    <apex:variable var="showRestoreButtons" value="true"/>
    <apex:variable var="height" value="300px"/>
    <apex:variable var="width" value="100%"/>
    <p>Cases</p>
    <apex:iframe src="/apex/grax__GRAXRestore?Id={!recordId}&recordName={!recordName}&objToQuery={!objectName}&isEmbedded=1&isEmbeddedRelatedList=1&selectedFields={!fieldsToDisplay}&showPreviewButton={!showPreviewButton}&displayRestoreInfoSwitch={!displayRestoreInfoSwitch}&showRestoreButtons={!showRestoreButtons}" height="{!height}" width="{!width}" scrolling="true"/>
    <p>Contacts</p>
    <apex:variable var="objectName2" value="Contact" />
    <apex:variable var="fieldsToDisplay2" value="FirstName,LastName,Email" />
    <apex:iframe src="/apex/grax__GRAXRestore?Id={!recordId}&recordName={!recordName}&objToQuery={!objectName2}&isEmbedded=1&isEmbeddedRelatedList=1&selectedFields={!fieldsToDisplay2}&queryFilter={!queryFilter}&showPreviewButton={!showPreviewButton}&displayRestoreInfoSwitch={!displayRestoreInfoSwitch}&showRestoreButtons={!showRestoreButtons}" height="{!height}" width="{!width}" scrolling="true"/>
</apex:page>

Parameter Breakdown:

Parameter

Value

Description

recordId*

{!sObject.id}

This is the Id of the sObject that the Restore VF page resides on.

recordName*

{!sObject.name}

This is the name of the sObject that the Restore VF page resides on.

objectName*

sObject

This is the related sObject that will be queried.

fieldsToDisplay*

Field1,Field2,...

These are the sObject field names that will be displayed.

queryFilter

'value'

This parameter will allow you to filter your query results.

showPreviewButton

true

This parameter will display the preview buttons on each record.

displayRestoreInfoSwitch

true

This parameter will display the restore information buttons.

showRestoreButtons

true

This parameter enables the restore button on each record.

height

300px

This parameter defines the height of the iFrame.

width

100%

This parameter defines the width of the iFrame.

scrolling

true

This parameter enables scrolling in the iFrame.

📘

Note

The suggested default values are noted in the table above. Fields marked with "*" can be changed on a per object basis. Changing other values may have unintended results.

  1. Navigate to the sObject record that you want to add the Visualforce page to (ie. Account).

  2. On the record page, click Edit Layout at the top right of the page.

  3. Add a new section and label it GRAX Restore. Set the layout to 1-Column, deselect Edit Pageand click OK.

  4. In the dropdown at the top of the page, scroll down to Visualforce Pages on the left hand column. Once selected, find the GRAX Restore page and drag it into the corresponding section.

  5. In the new section where you dragged the Visualforce page into, click on the wrench on the far right (Properties). Set the height to recommended value of 700, select Show scrollbars option, and click OK.

  6. Select Save in the dropdown at the top of the page to save the page layout.