How to store the Search Index in the Custom Object itself
When using Custom Objects and the Search Index feature, an additional field is required in order to store the Search Index in the Object record Itself. This tutorial will show you how to create that field.
The default setting is storing the index in the Index Object. When you create a Search Index, the indexes are stored in a custom object called "Index Object".
Each record that is indexed takes 2kb of storage space.
Another option is to store the index in the Object itself. This will store the index in a field in your record, which takes no additional storage space. As a result of updating the record, the last modified date of all records will change.
These settings can be changed from DC Setup > *Object*(Leads, Contacts, etc.) > *Object* Settings > toggle Advanced Settings > Index Location
Step 1 Create the Search Index field in your Custom Object
In this tutorial, we are using the Opportunity Object as an example. This tutorial works with any other Custom Object.
Navigate to Salesforce Setup
Open the Object Manager.
Find and click on the Custom Object to which you want to add the Search Index field, in this tutorial we are using the "Opportunity" object.
Click on the "Fields & Relationships"
Click the "New" button to create a new field.
On Step 1, choose "Text Area (Long)" and then click "Next"
On Step 2, fill only the following field and then click "Next"
Field Label: Duplicate Check Index Field Name: dc3Index
Depending on your Salesforce edition (Professional and up), you will now get a screen to establish field-level security. Decide who may see the Duplicate Check Index field and click 'Next'.
Depending on your Salesforce edition (Professional and up), you will now get a screen where you are able to add the Duplicate Check Index fieldto the page layout. Add the field to the pages you would like. Click "Save"
The Search Index field was successfully created for your Custom Object. Now continue with the tutorial to learn how to enable and create a Search Index.
Step 2 Enable and create the Search Index for your Custom Object
Navigate to DC Setup
Click on the Opportunity Object on the left side menu
Navigate to the "Opportunity Settings" tab
Enable the "Search Index" setting, then toggle the "Show Advanced Settings" button.
Scroll down until the "Index" options, for "Index Location" choose "Opportunity Object -- Duplicate Check Index"
Now after you have enabled the Search Index and selected where to store it, navigate to the "Search Index" tab.
Click the "Create Index" button. Once the search index is created, you can start searching for duplicates within your Custom Object. The creation time depends on your Object record count. The Search Index will update automatically for all new and modified records. Click here to see a short video of step 2.7.