Lookup Setup
Prerequisites
To set up lookups, you need the following permissions:
-
Minimum permissions for the FieldFX modules you are using
-
System permissions:
-
Customize Application
-
View Setup and Configuration
-
Considerations
-
We do not support lookups to transactional objects from FieldFX Mobile.
Transactional objects include:
-
Job
-
Ticket
-
Ticket Item
-
Ticket Log
-
Price Book
-
Quote
-
Quote Item
-
FX Forms
-
Master-Detail children of FX Forms
-
-
You cannot create lookups and child collections on the same object where both have the same
relationshipName
.
Adding a Lookup
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the custom object on which to add the lookup
-
Complete the following:
-
Under Custom Fields & Relationships, click New
-
Select Lookup Relationship
-
Click Next
-
Select the object for the lookup
Select "Contact" if you are adding a Contact lookup.
-
Click Next
-
Enter field attributes
-
Click Next
-
Click Visible twice
-
Click Next
-
Select the page layouts on which to include the lookup
-
Click Next
-
Set related list options
-
Click Save
-
-
Grant permissions for the lookup
Lookup Filters
Basics
-
Lookup filters control the records shown in lookups.
Permission sets and sharing settings control the records you have permission to access. -
Lookup filters improve data quality by preventing you from selectinginvalid records.
-
Lookup filters for FieldfX Back Office are maintained separately from the filters used for FieldFX Mobile.
Examples
Customer Lookup
Basic Customer Lookup on the Job Object
"Account": {
"FX5__Job__c.FX5__CustomerAccount__c": {
"predicate": "Account.RecordType.DeveloperName != 'Office' && (ISNULL($Source.FX5__Price_Book__c) || ISNULL($Source.FX5__Price_Book__r.FX5__Account__c) || $Source.FX5__Price_Book__r.FX5__Account__c==Account.Id)"
}
}
Advanced Customer Lookup on the Job Object
"Account": {
"FX5__Job__c.FX5__CustomerAccount__c": {
"predicate": "Account.RecordType.DeveloperName != 'Office' && (ISNULL($Source.FX5__Price_Book__c) || ISNULL($Source.FX5__Price_Book__r.FX5__Account__c) || $Source.FX5__Price_Book__r.FX5__Account__c==Account.Id)",
"sortFormula": {
"formula": "Account.Name",
"limit": "10",
"sort": "asc"
}
}
}
|
Office Lookup
Scenario
Here’s a lookup filter for the Office lookup on the Job object.
"Account": {
"FX5__Job__c.FX5__Office__c": {
"predicate": "Account.RecordType.DeveloperName=='Office' && (ISNULL($Source.FX5__Price_Book__c) || ISNULL($Source.FX5__Price_Book__r.FX5__Office__c) || $Source.FX5__Price_Book__r.FX5__Office__c==Account.Id)"
}
}
Contact Lookup
Basic Contact Lookup on Ticket Item Object
"Contact": {
"FX5__Ticket_Item__c.FX5__Contact__c": {
"predicate": "Contact.FX5__Available_for_Field_Work__c==true"
}
}
Advanced Contact Lookup on Ticket Item object
"Contact": {
"FX5__Ticket_Item__c.FX5__Contact__c": {
"predicate": "Contact.Contact_Record_Type__c=='User Contact'"
}
}
|
Equipment Lookup
Basic Equipment Lookup on the Ticket Item Object
"FX5__Equipment__c" : {
"FX5__Ticket_Item__c.FX5__Equipment__c": {
"predicate": "($Source.CatItem_ID__c==FX5__Equipment__c.CatItem_ID__c)"
}
}
The predicate formula configures the lookup to display equipment linked to a catalog item.
|
Well Lookup
Advanced Well Lookup on the Job Object
"FX5__Well__c": {
"FX5__Job__c.FX5__Well__c": {
"sortFormula": {
"formula": "FX5__Well__c.FX5__Current_Drilling_Depth__c",
"thresholdFloor": "3000",
"thresholdCeiling": "9000",
"limit": "25",
"sort": "desc"
}
}
}
|
Adding a Lookup Filter
FieldFX Back Office
The user’s Profile or Permission Set must grant access to the |
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the object that features the lookup
-
Under Custom Fields & Relationships, click Edit next to the lookup
-
Under Lookup Filter, click Show Filter Settings
-
Under Filter Criteria, select the criteria to use for the lookup filter
-
Click Save
FieldFX Mobile
Mobile filters should now be maintained in the Admin Portal’s dedicated Mobile Filters tool. |
-
Add an FX_Mobile_Filters static resource:
-
Open a text editor
-
Enter the following to name the static resource:
window.FX_Mobile_Filters = {
-
Enter the API name of the related object for the lookup:
window.FX_Mobile_Filters = { "FX5__Price_Book__c": {
-
Enter the lookup’s object followed by the lookup’s API name:
window.FX_Mobile_Filters = { "FX5__Price_Book__c": { "FX5__Job__c.FX5__Price_Book__c": {
-
You can only add lookup filters for lookups on the Quote, Quote Item, Job, Ticket, Ticket Item, and FX Form objects.
-
You can add an unlimited number of lookup filters for each supported object.
-
-
Enter the formula to use for the lookup filter:
window.FX_Mobile_Filters = { "FX5__Price_Book__c": { "FX5__Job__c.FX5__Price_Book__c": { "predicate": "(ISNULL($Source.FX5__CustomerAccount__c) || $Source.FX5__CustomerAccount__c==FX5__Price_Book__c.FX5__Account__r.Id || ISNULL(FX5__Price_Book__c.FX5__Account__r.Id)) && (ISNULL($Source.FX5__Office__c) || $Source.FX5__Office__c==FX5__Price_Book__c.FX5__Office__r.Id || ISNULL(FX5__Price_Book__c.FX5__Office__r.Id)) && (ISNULL($Source.FX5__Segment__c) || $Source.FX5__Segment__c==FX5__Price_Book__c.FX5__Segment__c || ISNULL(FX5__Price_Book__c.FX5__Segment__c))"
-
Don’t use Roll-Up Summary fields in the formula.
-
Only use supported functions and operators in the formula.
-
Refer to the Formulas article for a list of supported functions and operators.
-
-
Add closing braces
}
to end the lookup filter:window.FX_Mobile_Filters = { "FX5__Price_Book__c": { "FX5__Job__c.FX5__Price_Book__c": { "predicate": "(ISNULL($Source.FX5__CustomerAccount__c) || $Source.FX5__CustomerAccount__c==FX5__Price_Book__c.FX5__Account__r.Id || ISNULL(FX5__Price_Book__c.FX5__Account__r.Id)) && (ISNULL($Source.FX5__Office__c) || $Source.FX5__Office__c==FX5__Price_Book__c.FX5__Office__r.Id || ISNULL(FX5__Price_Book__c.FX5__Office__r.Id)) && (ISNULL($Source.FX5__Segment__c) || $Source.FX5__Segment__c==FX5__Price_Book__c.FX5__Segment__c || ISNULL(FX5__Price_Book__c.FX5__Segment__c))" } } }
Every left brace
{
should have a matching right brace}
. -
Save the file with "FX_Mobile_Filters" as the file name
-
-
Upload the FX_Mobile_Filters file to FieldFX Back Office:
-
From Setup, enter "static" in the Quick Find box, then select Static Resources
-
Click New
-
In Name, enter "FX_Mobile_Filters"
-
In Cache Control, select "Public"
-
Click Choose File
-
Select the FX_Mobile_Filters file
-
Click Save
Lookup Filter Builder
Basics
You must define lookup filters for FieldFX Back Office and FieldFX Mobile separately.
Mobile lookup filters are maintained in the Admin Portal’s dedicated Mobile Filters tool. |
The Lookup Filter Builder makes it easier to add lookup filters that work systemwide.
How It Works
When you run the Lookup Filter Builder, it:
-
Analyzes FieldFX Back Office to look for lookup filters.
-
Creates a new FX5__Mobile_Filters static resource containing every lookup filter in FieldFX Back Office.
-
Creates a backup copy of the current FX5__Mobile_Filters file for your org.
-
Replaces the existing FX5Mobile_Filters file with the new FX5Mobile_Filters file.
-
Uploads the backup copy of the previous FX5__Mobile_Filters file to the static resource list for your org.
Once the Lookup Filter Builder uploads a new FX5_Mobile_Filters file, the lookup filters listed in the file work systemwide.
Setting Up the Lookup Filter Builder
-
From Setup, enter "remote" in the Quick Find box, then select Remote Site Settings
-
Click New Remote Site
-
In Remote Site Name, enter "SFDCToolingAPI"
-
In Remote Site URL, enter the domain in which your org runs
Example 1. Finding your domainTo get the URL for your domain, copy the first part of the URL from the address bar in your browser:
For example:
https://na43.salesforce.com
The Remote Site URL field is case-sensitive. Make sure the URL you enter uses the correct capitalization.
-
Click Active
-
Click Save
-
Complete one of the following:
Scheduling the Lookup Filter Builder to Run Automatically
Prerequisite
Set up the Lookup Filter Builder
-
From Setup, enter "apex" in the Quick Find box, then select Apex Classes
-
Click Schedule Apex
-
In Job Name, enter "Lookup Filter Builder"
-
In Apex Class, select "LookupFilterHandler"
-
Select how often you want the Lookup Filter Builder to run
Select a frequency of at least once per week. -
Click Save
Running the Lookup Filter Builder Manually
Prerequisite
Set up the Lookup Filter Builder
-
Select Utilities → Apex Execute
-
Enter the following script:
System.debug(FX5.FXWorkerLauncher.DoWork('FX5.LookupFilterHandler', null));
-
Click Execute
The Lookup Filter Builder:
-
Analyzes FieldFX Back Office to look for lookup filters.
-
Creates a new FX5__Mobile_Filters static resource containing every lookup filter in FieldFX Back Office.
-
Creates a backup copy of the current FX5__Mobile_Filters file for your org.
-
Replaces the existing FX5Mobile_Filters file with the new FX5Mobile_Filters file.
-
Uploads the backup copy of the previous FX5__Mobile_Filters file to the static resource list for your org.
-
Search Filters
How It Works
In FieldFX Back Office lookups, search filters display above search results.
In FieldFX Mobile lookups, search filters display on the sidebar.
Enabling Enhanced Lookups
You must enable the Enhanced Lookups feature to use search filters in FieldFX Back Office lookups.
-
From Setup, enter "search settings" in the Quick Find box, then select Search Settings
-
Under Lookup Settings, select Enhanced Lookups
-
Click Save
Adding Search Filters
FieldFX Back Office
Prerequisite
Enable Enhanced Lookups
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the Settings page for the lookup’s related object
Example 2. To add an Equipment lookupOpen the Settings page for the Equipment object to configure an Equipment lookup.
-
Complete the following:
-
Under Search Layouts, click Edit next to Lookup Filter Fields
-
In Available Fields, select fields to use as search filters
-
Click Add
-
Click Save
-
FieldFX Mobile
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the Settings page for the lookup’s related object
Example 3. To add an Equipment lookupOpen the Settings page for the Equipment object to configure an Equipment lookup.
-
Complete the following:
-
Under Search Layouts, click Edit next to Search Results
-
In Available Fields, select fields to use as search filters
-
Click Add
-
Click Save
-
Search Results Fields
Configuring Search Results Fields
FieldFX Back Office
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the object that features the lookup
-
Complete the following:
-
Under Search Layouts, click Edit next to Lookup Dialogs
-
In Available Fields, select new fields to include
-
Click Add
-
In Selected Fields, select fields to remove
-
Click Remove
-
In Selected Fields, change the order
-
Select Override the search result column customizations for all users
-
Click Save
-
FieldFX Mobile
-
From Setup, enter "object" in the Quick Find box, then select Objects
-
Open the object that features the lookup
-
Complete the following:
-
Under Search Layouts, click Edit next to Search Results
-
In Available Fields, select new fields to include
-
Click Add
-
In Selected Fields, select fields to remove
-
Click Remove
-
In Selected Fields, change the order
-
Select Override the search result column customizations for all users
-
Click Save
-
Optimizing Lookup Load Times
Your permissions and record access both affect how long it takes to open lookups.
To optimize performance:
-
Add lookup filters to every lookup so that only relevant records display
-
Only give FieldFX Mobile users Read permission to essential fields on each object
Custom Editors
You can use Custom Editors to enhance FieldFX Back Office lookups.
Refer to the Custom Editors Setup article for details.