
Hey folks
I use a sort of Constructor Classes for my most used objects in test classes. Within those classes, I populate required fields with standard values and depending on the given parameters when calling the constructor, also optional fields. One of the required fields on Account is the Account Name. Now with Duplicate Management enabled, the Accounts created are counted as a match and due to my set up rules to prevent people from creating duplicates, these test Accounts are considered dupes.The way I currently set up the name is as follows:
public static list<Account> getAccs(Integer quantity, String namePrefix)
{
list<Account> accs = new list<Account>();
for ( Integer i = 0; i < quantity; i++ )
{
Account acc = new Account();
// Required fields
acc.Name = namePrefix + ' Test ' + i;
// [...]
}
}
The Account Type is chosen at random and if optional fields are not populated, nothing else but Name & Type will be filled.
Is there a way to either exclude them from the matching rule criteria or can anyone tell me how fuzzy account names need to be to not be considered as a match? For example not considering those with "Name contains 'Test' ". I know my current way is sure to produce a match, because it differs by but one number. I could consider adding a large random number at the end of the string.
Thanks