Overview
Resource Keys describe how to uniquely identify records. For example, a contact record could be uniquely identified by their email address. The Resource Key will be functional once its Generating hashes flag is "No". It may take a few minutes for the flag to turn from "Yes" to "No" if there are numerous records to process.
One or more properties of the record are selected when creating a resource key and ReadiNow ensures that no two records have the same values for those records.
Configuring a resource key
Resource keys are applied to an Object. That is, a type of record. If a resource key is applied to an Object, then it will also automatically apply to any other Objects that inherit from that object.
To define a resource key:
- Select Administration from the Application Menu. The menu appears with available applications.
- Select Resource Keys, located under the Resources section. This will list all resource keys for all objects.
- Select +NEW. The Resource Key form appears.
- Type a name in the Name field.
- Type a description in the Description field.
- If the resource key should automatically merge records, then select the checkbox for Merge duplicate.
- Type a message that should be shown if someone attempts to create a duplicate record (optional) .
- Select the Object that the resource key applies to.
- On the Resource Key Fields tab, select ACTION. The menu appears.
- Select Link to existing. The Select dialog appears.
- Select the field you want to include in the resource key - ensuring that the field belongs to the correct object.
- On the Resource Key Relationships tab, select +NEW. The Resource Key Relationship form displays. Note: You can add a new relationship, choice field, or lookup to the resource key.
- In the 'Resource key relationship' field, select the relationship. Note: Make sure either the From Object or To Object refers to the current object.
- Select 'Forward' from the dropdown if the relationship is being followed in the forward direction (e.g. if the From Object matches the current object).
- Or select 'Reverse' from the dropdown if the relationship is being followed in the reverse direction (e.g. if the To Object matches the current object).
- Select Save to save the resource keys.
To manage resource keys, navigate to Administration > Resources > Resource Keys
Create a new Resource Key and select the object that it applies to.
Enforcing Resource Keys
The platform enforces that each record is unique, and it can do this in one of two ways.
- The resource key can be configured to disallow two records with the same key. If a new record is created to have the same value as an existing record, then the new record cannot be saved. For example, in this mode, it would not be possible to create a new contact record if there is already another contact record with the same email address.
- The resource key can be configured to merge records with the same key. If a new record is created to have the same value as an existing record, then the details of the two records are merged together into a single key.
Resource keys that use multiple fields
A resource key may be set up to allow more than one field to be specified. If multiple fields are specified, then no two records can exist that have the same value for all of the fields. It is still allowable to create multiple records that have the same values for some fields, and not others.
For example, a resource key could be created on the First Name and Last Name fields. This would enforce that no two records have the same First Name and Last Name. Two records could exist that share the same first name, but have different last names. Similarly two records could share the same last name if they have different first names. However, the combination of the two must be unique. In practice this example is not recommended, as sometimes people have the same name.
Multiple resource keys
In addition to specifying multiple fields on a resource key, it is also possible to specify multiple resource keys. A second resource key might be desirable to enforce uniqueness on unrelated fields. For example, one resource key could ensure that First Name and Last Name are together unique, while a second resource key could ensure that every contact has a unique email address. In this way, no two records can share the same first/last name combination, nor can they share the same email address.
Resource Keys that include relationships
In addition to including fields, a resource key can also include one or more lookups or relationships. For example, consider a Plan record that relates to Plan Step records. Each Plan Step might have a step number field. We can enforce that the number of each step is unique within the plan, (but not unique across all steps) by creating a resource key that includes both the step number field and the lookup to the Plan. In this way, the step number field must be unique, but only within the plan.
Existing Data
If a resource key is set up for an object that has existing data, then that existing data is not automatically consolidated. However, anyone attempting to subsequently save those duplicate records will be prompted to resolve the problem.
Importing Data
Ensure that the Generating hashes flag is false before importing data. If data is being imported using a spreadsheet, then the spreadsheet import feature will match imported data to existing data by using resource keys. The import spreadsheet feature has an option to automatically merge records, even if the resource key is not set up to support merging.