Documentation

crm.duplicate.findbycomm

Scope: catalog Permissions to execute: for all

crm.duplicate.findbycomm()

The method returns IDs for leads, contacts or companies that contain the specified phone numbers or e-mails.

Parameters

Parameter Description
type Specifies the type of communication to search. It can be one of the following values:
  • EMAIL - the e-mail addresses;
  • PHONE - the phone numbers.

This parameter is required.

values An array containing up to 20 e-mails or phone numbers. Values is limited to reduce load. ). Required parameter. Method returns not more than 20 duplicated per entity.

When an entity has 20 and more duplicates, results for the remaining entities won't be returned. For example, we didn't specify entity_type and awaiting duplicates for all three entities, but have 20 or more duplicates for leads. It means that contact and company duplicates won't be returned. If a contact entity has 20 or more duplicates, we'll get duplicates for leads and contacts and a company will be missing in the fetched selection.

entity_type Optional parameter. It can be skipped: all three entity types will be returned in this case. If this parameter is used, you can operate only with one of them. If you specify an array or non-existent parameter, all entity types will be returned. Types of entities:
  • LEAD - search leads;
  • CONTACT - search contacts;
  • COMPANY - search companies.

Return Value

The result is returned as an object containing arrays with IDs of the matching leads, contacts and companies.

Use the type name to access data in the array. For example:

	
 { 'LEAD': [1, 2, 3], 'CONTACT': [4, 5, 6], 'COMPANY': [7, 8, 9] }


Example of searching for a contact by a phone number:

//Contact search by phone 
        BX24.callMethod(
            "crm.duplicate.findbycomm", 
            {
                entity_type: "CONTACT",
                type: "PHONE",
                values: [ "8976543", "11223355" ],
            }, 
            function(result) 
            {
                if(result.error())
                    console.error(result.error());
                else
                {
                    console.dir(result.data());          
                }
            }
        );


© «Bitrix24», 2001-2024