function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Silpi Roy 19Silpi Roy 19 

Apex code for duplicate

I am new to salesforce need help to write apex class for the following criteria:

Inputs

 
ParameterOptionalComments
TypeNName of the ruleset
CreateContactNCreate Contact 1 (Yes) 0 (No) if match not found
ContactFirstNameNFirst name
ContactLastNameNLast Name
ContactHomePhoneNPhone Number
ContactTitleNTitle
ContactGenderNGender
ContactDOBNDate of Birth
ContactPostcodeNPost Code
ContactEmailAddressNEmail Address
ContactBTNumberYBT Number
ContactCoachCodeYCoach Code
ContactATPIdYATP Id
ContactWTAIdYWTA Id
ContactIpinIdYiPin Id
ContactTEIdYTE Id
ContactOfficialNumberYOfficial Number
 

Outputs

ParameterOptionalComments
ContactRowIdNSiebel Id of winning match if match found
StatusNNoMatch – no matches found
Match – one match found
Duplicate – duplicate matches found
Error - error
UsernameNUsername of winning match
IsMemberNIs the winning match a BT member?
IsClubAffiliatedNIs the winning match affiliated to a venue?
ContactListYSearch Expression of matching contacts in the format [Contact Id] = ‘X’ OR [Contact Id] = ‘Y’
 

Algorithm


There are three entry points for contact match:
 
  1. ContactMatch (match for given criteria and contact data)
  2. ContactMatchBatch (as above for for multiple contact records)
  3. ContactMatchIO (as contact match except input paramters are in an IO instead)


ContactMatch
Read Input Parameters
Read External Parameters from category “ContactMatch” + Type (input parameter)

For each criteria row where there is non null contact data
Status = ContactSearch
Exit if match found
End Loop

If CreateContact = 1 and ContactId = “” and Status <> “Error” then
            ContactCreate
End If

If Type = “InternationalPlayers” and ContactId <> “” and (Status = “Match” or “Duplicate”) then
            Status = ContactUpdate
End If

PostMatchActions

Return ContactId, Status, IsMember, IsClubAffiliated, LoginName, ContactList

ContactMatchBatch
Invoked by Contact List Applet (Admin) via BC LTA Contact Administration where Type = “UI”
Or by workflow process “LTA Contact Match” where Type = “Batch”

            Read Input Parameters

Query for contact search expression
Loop
            Retrieve data fields from contact record
            ContactMatch
End Loop

ContactMatchIO
Invoked by workflow “LTA PDS Publish Catalog Web Service” or “LTA Zendesk Query Contact Web Service”

Retrieve data fields for contact

ContactMatch
Thanks in advance