Apex API

The support of Duplicate Check's Apex API is only available in our Premium edition
You can use our APEX API code to use Duplicate Check in your own visual force pages.


dc3Api Methods

The following methods are available in the dc3Api class.



doSearch (Sobject objectData)

Executes a search with the Duplicate Check search engine.

Input is any instance of a Sobject class.

Output is a map with search results. Where the Key in the Map contains the object Name.

    Return: Map<String, List<dc3SearchResult>>



doSearch(Id objectId)


Executes a search with the Duplicate Check search engine.

Input is an Id of an existing record in Salesforce.

Output is a map with search results. Where the Key in the Map contains the Object Name.

    Return: Map<String, List<dc3SearchResult>>



doSearch(Map<String, Object> objectData, String objectPrefix)


Executes a search with the Duplicate Check search engine.

Input is a Map. Where the key contains the API Fieldname and the value contains the field value.

Input is String which contains the object key prefix of the object you want to search on. (eg; Lead = '00Q')
.
Output is a map with search results. Where the Key in the Map contains the Object Name.

    Return: Map<String, List<dc3SearchResult>>



getResultFieldList(String objectPrefix)


Retrieves the configured result fields for the given object.

Input is a String with the object prefix. For example for Lead it is '00Q'.

Output is a List with the configured fields.

    Return: List<dc3Config.ResultField>



doMerge(List<Sobject> objectList)


Merges all the records in the objectList.

Input is a List of Sobjects.

Output is a Boolean containing TRUE when merge is successful.

    Return: Boolean



doMerge(List<Sobject> objectList, Sobject masterObject)


Merges all the records in the objectList and masterObject. Where masterObject is the remaining records. All records in the object List are merged into the masterObject.

Input is a List of Sobjects.

Input is a Sobject containing the masterObject.

Output is a Boolean containing TRUE when merge is successful.

    Return: Boolean



doDirectProcess(Id recordId)


Finds all duplicate records for the given recordId. When duplicates are found it automatically converts or merges the records if score is above or equals with the Direct Process configuration in the DC Setup. This process is asynchronous.

Input is an Id of a Salesforce record.

Output is a void. No output given.

    Return: void



doDuplicatePrevention(Sobject objectData)

Finds all duplicate records for the given objectData. When duplicates are found it will generate the Duplicate Prevention HTML section which can be displayed on your custom Visualforce page. If no result is found a null is returned.

Input is a Sobject instance.

Output is an ApexPages.Message.

    Return: ApexPages.Message

Set a different trigger source


This will not disable the triggers, but will override the execution of the triggers for an proceed.

    dupcheck.dc3TriggerProcessGlobal.setTriggerSource('TEST');


Usage Example

The code fragment below describes how you can search on the FirstName, LastName and Email field of the Lead object.

    // 1. Create Search Object
Lead ld = new Lead(FirstName='Test', LastName='TestName', Email='test@test.com');

// 2. Create Search Class
dupcheck.dc3Api api = new dupcheck.dc3Api(); 

// 3. Execute the search.
Map<String, List<dupcheck.dc3SearchResult>> searchResult = api.doSearch(ld); 

// 4. Debug the results.
if (searchResult.containsKey('Lead')) { 
  system.debug(searchResult.get('Lead')); 
}

dc3SearchResult -- Class Definition

data

  • Integer Score
  • Sobject objectData

Methods

getObjectName()
Returns the Object Name of the record in the objectData variable.

    Return: String


getObjectPrefix()
Returns the Object Prefix of the record in the objectData variable.

    Return: String


getDisplayField()
Returns a Map with the field you want to display, this includes the actual field data.

    Return: Map<String, Object>
Sort()

Sorts a list containing dc3SearchResult based on score, highest score first.

dc3Config.ResultField -- Class Definition

data
  • String fieldName
  • String fieldLabel
  • Integer sortOrder
  • Id resultFieldId
  • Id recordTypeId
method
  • Sort()
    Sorts a list containing dc3Config.ResultField based on the sortOrder, lowest sortOrder first.
 

Having trouble?

Our support agents are ready to help you !