Salesforce - Set up Lookup

Support DQE
Support DQE
  • Updated

Custom Settings

  1. Go to the Custom Settings section. A custom setting named DQE Unify Lookup is available.
DQE Unify Lookup custom setting
  1. Click Manage and create an instance at your organization default level.
    Create DQE Unify Lookup custom setting instance
  2. Fill in the required information.
    DQE Unify Lookup settings
  • Allow Skip: allows users to skip Unify Lookup suggestions and create a new record.
  • App Named Cred: name of the named credential.
  • Displayed Fields: fields displayed in the suggestions table.

Access to the Record Lookup app

You can now go to the Lightning Record Lookup app and click Connect at the bottom of the Setup tab. This establishes the connection between your Salesforce org and your Unify Lookup Server instance.

Record Lookup app connection

Record Lookup

Once the installation is complete, configure the Record Lookup app by following these steps:

  1. Connect it to the Customer_Dqe_one named credential.
  2. Upload your rule and select the object to be indexed.

Then, follow the steps below to override the standard New button with the Record Lookup button:

  1. Go to Salesforce Setup.
  2. Open Object Manager.
  3. Select the relevant object.
  4. Locate the New button.
  5. Override the button with the Record Lookup button.
DQE One Record Lookup button

This guide explains how to set up Record Lookup in Salesforce.

API guide

This section describes the APIs exposed by the Record Lookup app.

Federated Search

OpenSearch Description

Salesforce provides an integration protocol for external data sources. Full documentation is available in the Salesforce Federated Search documentation.

To comply with this protocol, the Unify Lookup application exposes an XML-Atom API in two parts. The first part describes the format.

  • Route: /api/openSearch.xml
  • Call:

    curl -X GET https://[YOUR APP URL]/api/openSearch.xml
  • Response:
    OpenSearch XML response

Since the format must be unique for all responses, the field list is immutable. For each type of record indexed in the Unify Lookup app, you can map an address, email, phone number, first name, and last name.

The Source field corresponds to the record type. For example, if the app indexes Salesforce objects, possible values include Lead, Account, and Contact. For external PostgreSQL tables, the source is named after the table.

OpenSearch Format

The second OpenSearch API is the request for a resource itself.

When this API is used from the external source search bar in your Salesforce org, the settings are passed automatically.

  • Route: /api/openSearch
  • Parameters:
    • search (string): search terms
    • orgId (string): Salesforce org ID
  • Call:

    curl -X GET https://[YOUR APP URL]/api/openSearch?search=Ms. Cha Fadner&orgId=[YOUR ORG ID]
  • Response:
    OpenSearch response

REST API

In addition to the XML APIs used by your Salesforce org, the Unify Lookup server exposes APIs that allow you to perform real-time pre-existence lookups from external systems. This section describes these APIs and their call methods.

Authentication

All APIs described below are secured with Basic Auth. The username is the identifier of the registered Salesforce organization, and the password is the licence key provided by DQE Software. This is the same key entered in the environment variables of your application.

Search

This API is an autocomplete engine on a single search line. It returns a list of suggested potential records matching the search criteria.

Route: /api/searchRecords

Parameters:

  • search (string): search terms

Response structure:

The response is a list of objects structured with fields such as Id, Source, FirstName, LastName, Phone, Email, Street, City, PostalCode, State, and Country.

Example call:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/searchRecords?search=Ms. Chantal Fadner

Sample response:

[
  {
    "Id": "00Q0900000E3ded7FUEAZ",
    "Source": "Lead",
    "FirstName": "rerere",
    "LastName": "azazaza",
    "Phone": "0*****31",
    "Email": "*****@hotmail.fr",
    "Street": "R************NIERES",
    "City": "A**********X",
    "PostalCode": "12345",
    "State": "",
    "Country": "France"
  }
]

Lookup

This API performs a pre-existence search by comparing a complete record with all indexed records.

Route: /api/lookupRecords

Parameters:

You can provide any key/value pair present in your form, either in the body of your query or in the query parameters. Keys are case-sensitive. Keys that are not found in the records are ignored.

Response structure:

The response is a list of objects structured with fields such as Id, Source, FirstName, LastName, Phone, Email, Street, City, PostalCode, State, and Country.

Example call:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/lookupRecords?Email=airelue.fc@laposte.net&PostalCode=77961&Phone=0695473336&Street=Rue du Clos Gillet&FirstName=Aurélie&LastName=FUALKNER

Sample response:

[
  {
    "Phone": "**********",
    "City": "A*****LE",
    "FirstName": "Au****ei",
    "MobilePhone": "",
    "State": "",
    "PostalCode": "12345",
    "LastName": "F****ER",
    "Country": "France",
    "Email": "ai******@laposte.net",
    "Street": "Rue ********et",
    "Id": "00Q0900000E37F3EAJ",
    "Source": "Lead"
  }
]

If no deduplication rule sets have been imported into your application:

{
  "status": "error",
  "error": "No rules set loaded yet"
}

Golden record

This API performs a pre-existence search by comparing a complete record with all indexed records. Unlike the previous API, it only returns the record with the best match score.

Route: /api/lookupGolden

Parameters:

You can provide any key/value pair present in your form, either in the body of your query or in the query parameters. Keys are case-sensitive. Keys that are not found in the records are ignored.

Response structure:

The response contains the match certainty, the rule that matched the record, and the best matching record.

Example GET call:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/lookupGolden?Email=ai************.net&PostalCode=1234&Phone=*******&Street=Ru*********t&FirstName=A******&LastName=F*****

Example POST call:

curl --location 'https://[YOUR APP URL]/api/lookupGolden' \
--header "Authorization: Basic {authorization_header}" \
--header 'Content-Type: text/plain' \
--data-raw '{
  "recordType": "PersonAccount",
  "FirstName": "S*****",
  "LastName": "T****",
  "PersonEmail": "s************id"
}'

Sample response:

{
  "certainty": 0.05298333333333333335,
  "matched_by": "Address",
  "record": {
    "Phone": "***************",
    "City": "**********",
    "FirstName": "Au***********",
    "MobilePhone": "",
    "State": "",
    "PostalCode": "12345",
    "LastName": "*******************",
    "Country": "France",
    "Email": "******************.net",
    "Street": "Rue ****************et",
    "Id": "00Q0900000E37F3EAJ",
    "Source": "Lead"
  }
}

If no deduplication rule sets have been imported into your application:

{
  "status": "error",
  "error": "No rules set loaded yet"
}

In all other cases:

{
  "status": "error",
  "error": "bad request"
}

Add record

Use this API to add a record to your indexing registry without restarting a process across the entire Salesforce database.

Route: /api/add

Parameters:

  • recordType: SObject API name, for example Lead, Account, or Contact
  • Id: Salesforce ID

You can also provide any key/value pair present in your record in the query parameters. Keys are case-sensitive. Keys that are not found in the records are ignored.

Example GET call:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/add?recordType=Lead&Email=a************e.net&PostalCode=12345&Phone=0************&Street=Rue*************&FirstName=A**********&LastName=F********R

Example POST call:

curl --location 'https://[YOUR APP URL]/api/add' \
--header 'Authorization: Basic {authorization_header}' \
--header 'Content-Type: text/plain' \
--data-raw '{
  "0": {
    "Phone": "0***********6",
    "BillingStreet": "R***********t",
    "BillingPostalCode": "12345",
    "LastName": "*****",
    "PersonEmail": "a**************t",
    "BillingCity": "H*****************Y",
    "id": "[SALESFORCE ID]",
    "FirstName": "A****************e",
    "attributes": {"type":"PersonAccount"}
  }
}'

Successful response:

{
  "status": "success",
  "label": "Record added"
}

If the object API name is not one of the objects currently allowed to be indexed:

{
  "status": "error",
  "label": "RecordType not mapped in your application"
}

In this case, go to the Lightning Unify Lookup app and add the object.

If the record could not be added because the Redis database is running out of storage:

{
  "status": "error",
  "label": "memory > max memory"
}

In all other cases:

{
  "status": "error",
  "error": "bad request"
}

Remove record

Use this API to remove a record from your indexing registry without restarting a process across the entire Salesforce database.

Route: /api/delete

Parameters:

  • recordType: SObject API name, for example Lead, Account, or Contact
  • Id: Salesforce ID

You can also provide any key/value pair present in your record in the query parameters. Keys are case-sensitive. Keys that are not found in the records are ignored.

Delete a single record:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/delete?Id=00DX00000DJ19Q&recordType=Lead&Email=a*********net

Delete multiple records:

curl -X POST https://[YOUR APP URL]/api/delete \
-H "Authorization: Basic {authorization_header}" \
-d "[JSON Data]"

The JSON body should be structured as follows:

{
  "recordId": {
    "attributes": {
      "type": "recordType"
    }
  }
}

Successful response:

{
  "status": "success",
  "label": "Record(s) removed"
}

In all other cases:

{
  "status": "error",
  "error": "Failed to remove record"
}

Index Database

This API starts the global indexing process on an object. The object must already have been added through the interface to the list of objects, and a ruleset must be configured for it.

Route: /api/index

Parameters:

  • recordType: SObject API name, for example Lead, Account, or Contact
  • target: Salesforce org URL, in the format https://xxx.my.salesforce.com
  • token: valid Salesforce session token
  • user: Salesforce username associated with the session token

Example call:

curl -X GET \
-H "Authorization: Basic {authorization_header}" \
https://[YOUR APP URL]/api/index?recordType=Lead&token=XXXXXXXXXX&user=myusername@test.com&target=mysforg.my.salesforce.com

Successful response:

{
  "status": "success",
  "label": "indexing by Bulk started"
}

If the object API name is not one of the objects currently allowed to be indexed:

{
  "status": "error",
  "label": "RecordType not mapped in your application"
}

In this case, go to the Lightning Unify Lookup app and add the object.

In all other cases:

{
  "status": "error",
  "error": "bad request"
}

Apex REST resources

The AppExchange Unify Lookup package provides resources as Apex classes that can be invoked from your Apex classes or through APIs.

Authentication

The API resources described below can only be accessed with a valid Salesforce token retrieved through the OAuth2 API. The {authorization_header} variable in the following examples represents this session token.

UpdateDB

To insert or remove records from the indexed database, use this REST resource. Provide the record IDs, the object type, and the operation to apply.

Route: [YOUR SALESFORCE DOMAIN]/services/apexrest/UnifyLookup/updateDB/

Parameters:

  • ids: Salesforce record IDs separated by commas
  • recordType: SObject API name, for example Lead, Account, or Contact
  • action: Insert or Delete

Example call:

curl -X GET https://[YOUR SALESFORCE DOMAIN]/services/apexrest/UnifyLookup/updateDB/?ids=0017R00002ryGbZQAU,0017R00002kqzFHQAY&sObjectName=Account&action=insert \
-H "Authorization: Bearer {authorization_header}"

Successful response:

{
  "status": "success",
  "label": "Record added"
}

If an error occurs:

{
  "status": "error",
  "label": "Failed to add record"
}

Calling from an Apex class

You can also call the functions directly from your Apex classes because the Apex functions are defined as global.

deleteRecord

List<String> ids = new List<String>{'0017R00002ryGbZQAU', '0017R00002kqzFHQAY'};
String sObjectName = 'Account';
Map<String, String> res = UnifyLookup.DQE_Lookup_update_db.deleteRecord(ids, sObjectName);

insertRecord

List<String> ids = new List<String>{'0017R00002ryGbZQAU', '0017R00002kqzFHQAY'};
String sObjectName = 'Account';
Map<String, String> res = UnifyLookup.DQE_Lookup_update_db.insertRecord(ids, sObjectName);

Related to

Was this article helpful?

0 out of 0 found this helpful