Documentation

crm.address.list

Scope: crm Permissions to execute: for all

crm.address.list

Returns list of addresses by the filter. This is the implementation of the list method for addresses.

Addresses have been moved to requisites (however, CRM details show them as a separate field) - see requisite field description. CRM entity can have several associated requisites. Inside a requisite, there are several General details by templates, Bank details and Addresses.

Parameters

See. description of list methods.

Example


    //Search addresses by the type binding - Entity details
        BX24.callMethod(
            "crm.address.list", 
            { 
                order: { "TYPE_ID": "ASC" },
                filter: { "ENTITY_ID": 8},
                select: [ "TYPE_ID", "ADDRESS_1", "ADDRESS_2" ]				
            }, 
            function(result) 
            {
                if(result.error())
                    console.error(result.error());
                else
                {
                    console.dir(result.data());			
                    if(result.more())
                        result.next();						
                }
            }
        );

Response examples

  • In case an address is associated to an entity without a requisite/details (usually created when converting from a Lead with completed Address in details):

    [result] => Array
    (
    	[1] => Array
    	(
    		[TYPE_ID] => 1
    		[ENTITY_TYPE_ID] => 3
    		[ENTITY_ID] => 17192
    		[ADDRESS_1] =>
    		[ADDRESS_2] =>
    		[CITY] =>
    		[POSTAL_CODE] =>
    		[REGION] =>
    		[PROVINCE] =>
    		[COUNTRY] =>
    		[COUNTRY_CODE] =>
    		[LOC_ADDR_ID] => 0
    		[ANCHOR_TYPE_ID] => 3
    		[ANCHOR_ID] => 17192
    	)
    )
    

  • There are 2 different requisites for a contact with associated addresses:

    [result] => Array
    (
    	[2] => Array
    	(
    		[TYPE_ID] => 1
    		[ENTITY_TYPE_ID] => 8
    		[ENTITY_ID] => 7335
    		[ADDRESS_1] => Kernel st.
    		[ADDRESS_2] => 701
    		[CITY] => NY
    		[POSTAL_CODE] => 625003
    		[REGION] => New York State
    		[PROVINCE] => New York State
    		[COUNTRY] => USA
    		[COUNTRY_CODE] =>
    		[LOC_ADDR_ID] => 479
    		[ANCHOR_TYPE_ID] => 3
    		[ANCHOR_ID] => 17192
    	)
    )
    

    [result] => Array
    (
    	[3] => Array
    	(
    		[TYPE_ID] => 1
    		[ENTITY_TYPE_ID] => 8
    		[ENTITY_ID] => 8191
    		[ADDRESS_1] => Kernel st.
    		[ADDRESS_2] => 2
    		[CITY] => NY
    		[POSTAL_CODE] => 666000
    		[REGION] => New York State
    		[PROVINCE] => New York State
    		[COUNTRY] => USA
    		[COUNTRY_CODE] =>
    		[LOC_ADDR_ID] => 129
    		[ANCHOR_TYPE_ID] => 3
    		[ANCHOR_ID] => 17192
    	)
    )
    

    The field ANCHOR_TYPE_ID is completed by value from crm.enum.ownertype (example uses Contacts), and field ANCHOR_ID contains entity ID (Contacts, in this case). Fields ANCHOR_TYPE_ID and ANCHOR_ID in the two abovementioned examples are the same - it means that both addresses belong to the same Contact.



© «Bitrix24», 2001-2024