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

Introduction

Lookups are fields that feature a Search window to make selecting records easier.

Considerations

FieldFX doesn’t 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 can’t create lookups and child collections on the same object where both have the same relationshipName.

Adding a Lookup

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the custom object on which to add the lookup.

  5. Complete the following:

    1. Under Custom Fields & Relationships, click New.

    2. Select Lookup Relationship.

    3. Click Next.

    4. Select the object for the lookup.

      Select "Contact" if you are adding a Contact lookup.

    5. Click Next.

    6. Enter field attributes.

    7. Click Next.

    8. Click Visible twice.

    9. Click Next.

    10. Select the page layouts on which to include the lookup.

    11. Click Next.

    12. Set related list options.

    13. Click Save.

  6. Grant permissions for the lookup.

Lookup Filters

In FieldFX, you can use Lookup filters to control the records that appear.

Permission sets and sharing settings control the records you have permission to access.

With Lookup filters, FieldFX improves data quality by preventing you from selecting invalid records. They are maintained separately in FieldFX Back Office from the filters used for FieldFX Mobile.

Examples

These lookups can be used in the following 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)"
  }
}
The predicate formula configures the lookup to display customers and exclude offices.
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"
    }
  }
}
  • The predicate formula configures the lookup to display customers and exclude offices.

  • The formula setting configures the lookup to sort customers by name.

  • The limit setting configures the lookup to display the first 10 matching customers.

  • The sort setting configures the lookup to display customers in alphabetical order by customer name.

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)"
  }
}
The predicate formula configures the lookup to display offices and exclude customers.

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"
  }
}
The predicate formula configures the lookup to display contacts that have Available for Field Work selected.
Advanced Contact Lookup on Ticket Item object
"Contact": {
  "FX5__Ticket_Item__c.FX5__Contact__c": {
    "predicate": "Contact.Contact_Record_Type__c=='User Contact'"
  }
}
  • The predicate formula configures the lookup to display contacts that have the "User Contact" record type.

  • To implement this filter, you also need to:

    • Add a Contact Record Type field to the Contact object.

    • Select Formula as the field type and use the following formula for the field:

      RecordType.DeveloperName

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.
Advanced Equipment Lookup on the Ticket Item Object
"FX5__Equipment__c": {
  "FX5__Ticket_Item__c.FX5__Equipment__c": {
    "predicate": "( AND($Source.Field__c==FX5__Equipment__c.Field__c,$Source.FX5__Ticket__r.FX5__Job__r.FX5__CustomerAccount__r.Name==FX5__Equipment__c.Customer__c) )"
  }
}
  • The predicate formula configures the lookup to display equipment linked to the same customer as the job.

  • To implement this filter, you add a Customer lookup the Equipment object.

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"
    }
  }
}

Use these settings:

Setting Description

formula

Specifies the field by which to filter and sort wells in the lookup.

thresholdFloor

Excludes wells with a Current Drilling Depth less than 3000 feet.

thresholdCeiling

Excludes wells with a Current Drilling Depth more than 9000 feet.

limit

Configures the lookup to display the first 25 matching wells.

sort

Configures the lookup to display wells in alphabetical order by Current Drilling Depth.

Adding a Lookup Filter

FieldFX Back Office

The user’s Profile or Permission Set must grant access to the View Setup and Configuration System Permission for lookups to function in an FX Lightning component, such as the FX Data Grid.

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the object that features the lookup.

  5. Under Custom Fields & Relationships, click Edit next to the lookup.

  6. Under Lookup Filter, click Show Filter Settings.

  7. Under Filter Criteria, select the criteria to use for the lookup filter.

  8. Click Save.

FieldFX Mobile

Mobile filters should now be maintained in the Admin Portal’s dedicated Mobile Filters tool.

Scenario

This guide explains how to add a lookup filter to the Price Book lookup on the Job object.

This filter ensures the Price Book lookup only displays price books valid for the job’s customer, office, and segment

  1. Add an FX_Mobile_Filters static resource:

    1. Open a text editor.

    2. Enter the following to name the static resource:

      window.FX_Mobile_Filters = {
    3. Enter the API name of the related object for the lookup:

      window.FX_Mobile_Filters = {
        "FX5__Price_Book__c": {
    4. 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 these objects:

      • Quote

      • Quote Item

      • Job

      • Ticket

      • Ticket Item

      • FX Form

      You can add an unlimited number of lookup filters for each supported object.

    5. 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.

    6. 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 }.

    7. Save the file with the name FX_Mobile_Filters.

  2. Upload the FX_Mobile_Filters file to FieldFX Back Office:

    1. Access FieldFX Back Office.

    2. Switch to Salesforce Classic.

    3. From Setup, enter static in the Quick Find box, then select Static Resources.

    4. Click New.

    5. In Name, enter FX_Mobile_Filters.

    6. In Cache Control, select "Public".

    7. Click Choose File.

    8. Select the FX_Mobile_Filters file.

    9. Click Save.

      When you upload a new FX_Mobile_Filters file, the lookup filters in the new file replace any existing lookup filters. New lookup filters don’t activate until after users next sync data

Lookup Filter Builder

Define the 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 Lookup Filter Builder runs, 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 FX5__Mobile_Filters file with the new FX5__Mobile_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

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter remote in the Quick Find box, then select Remote Site Settings.

  4. Click New Remote Site.

  5. In Remote Site Name, enter SFDCToolingAPI.

  6. In Remote Site URL, enter the domain in which your org runs.

    Example 1. Finding your domain

    To get the URL for your domain, copy the first part of the URL from the address bar in your browser:

    Use your customized my domain URL that is specific to your org instead of your instance specific URL. You can find your my domain here.

    Don’t use instanced URLs when logging in to Salesforce with code or as a user. When your org is moved to another Salesforce instance, code using the instanced URL breaks. If you find instanced URLs in your code, replace them with your My Domain login URL or the default Salesforce login URL. See Log In to Salesforce with Code for more information.

    The Remote Site URL field is case-sensitive. Make sure the URL you enter uses the correct capitalization.

  7. Click Active.

  8. Click Save.

  9. Complete one of the following:

Scheduling the Lookup Filter Builder to Run Automatically

Prerequisite

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter apex in the Quick Find box, then select Apex Classes.

  4. Click Schedule Apex.

  5. In Job Name, enter "Lookup Filter Builder".

  6. In Apex Class, select "LookupFilterHandler".

  7. Select how often you want the Lookup Filter Builder to run.

    Select a frequency of at least once per week.
  8. Click Save

Running the Lookup Filter Builder Manually

Prerequisite

  1. Access FieldFX Back Office

  2. Access Workbench

  3. Select UtilitiesApex Execute.

  4. Enter the following script:

    System.debug(FX5.FXWorkerLauncher.DoWork('FX5.LookupFilterHandler', null));
  5. 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

You can use Search filters to refine the lookup search results.

How It Works

In FieldFX Back Office lookups, search filters display above search results.

Screenshot of search filters in a Job lookup in Back Office
Figure 1. Search filters in the Job lookup in FieldFX Back Office

In FieldFX Mobile lookups, search filters display on the sidebar.

Screenshot of search filters in an Equipment lookup in FieldFX Mobile
Figure 2. Search filters in an Equipment lookup in FieldFX Mobile

Enabling Enhanced Lookups

You must enable the Enhanced Lookups feature to use search filters in FieldFX Back Office lookups.

  1. Access FieldFX Back Office

  2. Switch to Salesforce Classic

  3. From Setup, enter search settings in the Quick Find box, then select Search Settings

  4. Select Enhanced Lookups under Lookup Settings.

    Screenshot of the Enhanced Lookups Checkbox in Lookup Settings
  5. Click Save

Adding Search Filters

The steps for adding a search filter is different between FieldFX Back Office and FieldFX Mobile.

FieldFX Back Office

Prerequisite

Complete Enabling Enhanced Lookups first.

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the Settings page for the lookup’s related object.

    Example 2. To add an Equipment lookup

    Open the Settings page for the Equipment object.

  5. Complete the following:

    1. Under Search Layouts, click Edit next to Lookup Filter Fields.

    2. In Available Fields, select fields to use as search filters.

    3. Click Add.

    4. Click Save.

FieldFX Mobile

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the Settings page for the lookup’s related object.

    Example 3. To add an Equipment lookup

    Open the Settings page for the Equipment object.

  5. Complete the following:

    1. Under Search Layouts, click Edit next to Search Results.

    2. In Available Fields, select fields to use as search filters.

    3. Click Add.

    4. Click Save.

Search Results Fields

Search results fields display information about search results in a lookup.

Configuring Search Results Fields

The steps for adding a search filter is different between FieldFX Back Office and FieldFX Mobile.

FieldFX Back Office

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the object that features the lookup.

  5. Complete the following:

    1. Under Search Layouts, click Edit next to Lookup Dialogs.

    2. In Available Fields, select new fields to include.

    3. Click Add.

    4. In Selected Fields,

      1. Select fields to remove and click Remove.

      2. Or change the order.

    5. Select Override the search result column customizations for all users.

    6. Click Save.

FieldFX Mobile

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. From Setup, enter object in the Quick Find box, then select Objects.

  4. Open the object that features the lookup.

  5. Complete the following:

    1. Under Search Layouts, click Edit next to Search Results.

    2. In Available Fields,

      1. Select new fields to include and click Add.

      2. Or to remove fields, select the fields and click Remove.

    3. In Selected Fields, change the order.

    4. Select Override the search result column customizations for all users.

    5. 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.

Sample FX_Mobile_Filters File