CompanyDuplicateFinder class
This Gosu class defines duplicate contact matching for the ABCompany subtype. If the subtype is ABCompanyVendor, ABAutoRepairShop, ABAutoTowingAgcy, ABLawFirm, or ABMedicalCareOrg, matching is performed for ABCompany. The class uses the query builder CompanyQueryBuilder, described at CompanyQueryBuilder class.
To open this class in Guidewire Studio™, navigate in the Project window to and then to gw.plugin.contact.findduplicates.CompanyDuplicateFinder.
- Fields to match
-
- Name
- Match this field as
starts withorequals, depending on context. - PrimaryAddress (AddressLine1, City, State, PostalCode)
- Match these PrimaryAddress fields as
equals. - TaxID
- Match this field as
equals. - WorkPhone or FaxPhone
- Match any single phone field as
equals.
- Required fields
- Name and at least one of PrimaryAddress,
TaxID, or any phone field: WorkPhone or
FaxPhone.
The following code defines the required fields for an ABCompany:
override function validateMandatoryFields() { if (_searchContact.Name == null or (hasNoPrimaryAddress() and hasNoPhoneNumber() and _searchContact.TaxID == null)) throwException(_searchContact) } - Potential match types
-
- Starts with Name and equals either PrimaryAddress or a phone field.
- Equals TaxID.
The following code defines the potential match fields for an ABCompany:
override function makeQueries() : List<Query<C>> { var queries = new ArrayList<Query<C>>() //Query: TaxID new CompanyQueryBuilder<C>(_searchContact) .hasEqualTaxId()//AND .buildAndAdd(queries) //Query: Name and PhoneNumber if (not hasNoPhoneNumber()) { new CompanyQueryBuilder<C>(_searchContact) .startsWithName()//AND .hasEqualPhoneNumbers() .buildAndAdd(queries) } //Query: Name and Address if (not hasNoPrimaryAddress()) { new CompanyQueryBuilder<C>(_searchContact) .startsWithName()//AND .hasEqualAddress() .buildAndAdd(queries) } return queries } - Exact Match
- Equals both TaxID and Name.
The following code defines the exact match fields for an ABCompany:
override function isExactMatch( searchContact : C, resultABContact : C) : boolean { return equalsAndNotNull<String>( searchContact.TaxID, resultABContact.TaxID) && equalsAndNotNull<String>( searchContact.Name, resultABContact.Name) }
