---
schema_version: "1"
id: 3473061cd72ff8281cdf1ac44b95668f4a3bfa3444dd14fdac461238a0028405
title: Get Lookup Field Suggestions
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_lookup_get.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_lookup_get.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e0d64b45916ea5f1ebd94736f71d4e2e4172a9efc8c020e4d4a9614a1e3c5688
description: When a user edits a lookup field, use this resource to search for and display suggestions. You can search for most recently used matches, for matching names, or for any match in a searchable field. You can also specify lookup filter bindings for dependent lookups.
---
# Get Lookup Field Suggestions

When a user edits a lookup field, use this resource to search for and display suggestions. You can search for most recently used matches, for matching names, or for any match in a searchable field. You can also specify lookup filter bindings for dependent lookups.

![Note](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/images/icon_note.png)

#### Note

In version 60.0 and later, use the [POST method](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_lookup_post.htm "When a user edits a lookup field, use this resource to search for and display suggestions. You can search for most recently used matches, for matching names, or for any match in a searchable field. You must specify dependent lookup field values used by lookup filters in the `sourceRecord` request body parameter.") for lookup field suggestions. The POST method is a more secure way of transferring data where the parameters are sent in the message body.

Resource

/ui-api/lookups/{objectApiName}/{fieldApiName}

- objectApiName—The API name of a source object.
- fieldApiName—The API name of a lookup field on the source object.

Available Version

41.0–62.0

HTTP Method

GET

Example: Get Most Recently Used Records

A lookup relationship field links a source object to a target object. To edit a lookup field, users click a lookup icon to search for and select a value from a popup list. The target object provides the values in the list.

For example, the Opportunity object has an AccountId lookup field. When a user edits an Opportunity record, the user selects an Account to associate with the Opportunity. To build a UI that suggests the most recently used Account records to the user, use this resource. The default value of the searchType parameter is Recent, so the request doesn’t specify it.

GET /ui-api/lookups/Opportunity/AccountId

Example: Search for Suggestions

To search all searchable fields for suggestions, set searchType=Search. This example searches for strings that start with the characters ca (a wildcard is implied).

GET /ui-api/lookups/Opportunity/AccountId?searchType=Search&q=ca

Example: Search Record Names for Suggestions

To search record name fields for suggestions, set searchType=TypeAhead. This example searches record names for strings that start with the characters ta (a wildcard is implied).

GET /ui-api/lookups/Opportunity/AccountId?searchType=TypeAhead&q=ta

Example: Search Dependent Lookups for Suggestions

Some lookup fields have lookup filters that restrict their valid values by referencing fields on the source object. These fields are called dependent lookups. For example, you can filter the Case Contact field to show only contacts that are associated with the account selected in the Case Account Name field.

In the Salesforce UI, this lookup filter is Contact Name: Account Name ID EQUALS Case: Account Name ID. In the User Interface API, lookup filter information appears in the filteredLookupInfo property of the [Object Info](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_object_info.htm#ui_api_responses_object_info "The metadata for an object.") response body, which is returned from several resources, including [/ui-api/record-ui/{recordIds}](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_ui.htm#ui_api_resources_record_ui "Get layout information, metadata, and data to build UI for a single record or for a collection of records."). If the filteredLookupInfo property is non-null, the field it describes is a dependent lookup.

In this example, the Case object’s ContactId field has a filteredLookupInfo property containing a controllingFields property. The controlling field is AccountId. To restrict the lookup search, you must pass all controlling fields and their values to the lookups resource in the dependentFieldBindings parameter.

 **"objectInfos" : {**
    ...
    **"Case" : { **      
      "apiName" : "Case",
      ...
      **"fields" : {**
       ...
        **"ContactId" : {**
          "apiName" : "ContactId",
          ...properties removed for space...
          **"filteredLookupInfo" : {
            "controllingFields" : \[ "AccountId" \],**
            "dependent" : true,
            "optionalFilter" : false
          },
          ...
          "sortable" : true,
          "unique" : false,
          "updateable" : true
        },
        ...

To get the value for AccountId, look in the [Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_record.htm#ui_api_responses_record "The field data, API name, child relationship data, and record type information for a record.") response body, which is returned from several resources, including [/ui-api/record-ui/{recordIds}](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_ui.htm#ui_api_resources_record_ui "Get layout information, metadata, and data to build UI for a single record or for a collection of records.").

**"records" : {**
    "500R0000000bKpBIAU" : {
      **"apiName" : "Case",**
      "childRelationships" : { },
      "fields" : {
        ...Some properties removed for space...
        **"AccountId" : {
**          "displayValue" : null,
          **"value" : "001R0000003IG0MIAW"
**        },
        "CaseNumber" : {
          "displayValue" : null,
          "value" : "00001005"
        },
        ...

To filter the suggestions for a dependent lookup, specify the names and values of the controlling fields in the dependentFieldBindings query parameter. (This example has one controlling field).

/ui-api/lookups/case/ContactId?dependentFieldBindings=AccountId=001R0000003IG0MIAW

Request Parameters

<table class="featureTable sort_table" summary="">





              <thead class="thead sorted" align="left">
                <tr>
                  <th class="featureTableHeader vertical-align-top " id="d57748e303">Parameter Name</th>

                  <th class="featureTableHeader vertical-align-top " id="d57748e306">Type</th>

                  <th class="featureTableHeader vertical-align-top " id="d57748e309">Description</th>

                  <th class="featureTableHeader vertical-align-top " id="d57748e312">Required or Optional</th>

                  <th class="featureTableHeader vertical-align-top " id="d57748e315">Available Version</th>

                </tr>

              </thead>

              <tbody class="tbody">
                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">targetApiName</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">String[]</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The API name of the object that you want results for. The name must
                    correspond to one of the target objects of the lookup field. If not provided,
                    by default, results for all target objects of the lookup field are returned.
                    If targetApiName isn’t specified, then the field configuration is used. If the
                    field is polymorphic, several queries are considered and you receive results
                    for every target that can lead to performance issues.</td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">59.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">dependent​FieldBindings</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">String[]</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The dependent field bindings for dependent lookups. These field bindings
                    represent the lookup filter that restricts the valid values for the field.
                    <p class="p">Specify field bindings in a comma-separated list in the format <samp class="codeph nolang">dependentFieldBindings={fieldApiName}​={fieldValue},{field2ApiName}={field2Value}</samp>.</p>
                    <p class="p">To
                      know whether a field is a dependent lookup, check the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_object_info.htm#ui_api_responses_object_info" title="The metadata for an object.">Object Info</a>
                      response body for a non-null <samp class="codeph nolang">filteredLookupInfo</samp> property. Specify the name and a value for
                      each field in the <samp class="codeph nolang">controllingFields</samp>
                      property. Get the field values from the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_record.htm#ui_api_responses_record" title="The field data, API name, child relationship data, and record type information for a record.">Record</a>
                      response body. Both responses are returned from the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_ui.htm#ui_api_resources_record_ui" title="Get layout information, metadata, and data to build UI for a single record or for a collection of records.">/ui-api/record-ui/{recordIds}</a> resource.</p>
                  </td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">page</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">Integer</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The page number. The default value is 1.</td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">pageSize</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">Integer</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The number of items per page. The default value is 25.</td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">q</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">String</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The term the user is searching for. <p class="p">When <samp class="codeph nolang">searchType=Search</samp>, specify at least 2 characters. A wildcard at
                      the end of the search term is implied. For example, <samp class="codeph nolang">q=ca</samp> returns Cat and Cats.</p>
                    <p class="p">When <samp class="codeph nolang">searchType=TypeAhead</samp>, specify at least 3
                      characters. A wildcard at the end of the search term is implied. You can’t
                      use a <samp class="codeph nolang">?</samp>.</p>
                  </td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Required if <samp class="codeph nolang">searchType</samp> is <samp class="codeph nolang">TypeAhead</samp>.</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d57748e303" data-title="Parameter Name"><samp class="codeph nolang">searchType</samp></td>

                  <td class="entry" headers="d57748e306" data-title="Type">String</td>

                  <td class="entry" headers="d57748e309" data-title="Description">The type of search to perform. One of these values:<ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Recent</samp>—Return most recently used
                        matches.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Search</samp>—Search for records with
                        searchable fields that match the query term.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">TypeAhead</samp>—Search for records whose
                        names start with the query term.
                      </li>

                    </ul>
                    <p class="p">The default value is <samp class="codeph nolang">Recent</samp>.</p>
                  </td>

                  <td class="entry" headers="d57748e312" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d57748e315" data-title="Available Version">41.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Lookup Values](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_lookup_values.htm#ui_api_responses_lookup_values "Records, organized by object type, and metadata in a lookup relationship.")