Documentation

crm.lead.list

Scope: catalog Permissions: all

Returns a list of contacts selected by the filter specified as the parameter. See the example for the filter notation.

Use masks when selecting leads:

  • "*" - for selection of all fields (excluding user and multiple fields)
  • "UF_*"- for selection of all user fields (without multiple fields)

Masks for selection of multiple fields are unavailable. To select multiple files, indicate the ones you need in the selection list ("PHONE", "EMAIL" and etc.).

Attention: Logic condition 'OR' for filter, if selected for several different fields - is unavailable.

Parameters

See the list method reference for the parameters.

Example

<script type="text/javascript">
    // Find unconverted leads whose opportunity value is over zero
		BX24.callMethod(
			"crm.lead.list", 
			{ 
				order: { "STATUS_ID": "ASC" },
				filter: { ">OPPORTUNITY": 0, "!STATUS_ID": "CONVERTED" },
				select: [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
			}, 
			function(result) 
			{
				if(result.error())
					console.error(result.error());
				else
				{
					console.dir(result.data());			
					if(result.more())
						result.next();						
				}
			}
		);
    // Find lead by phone number
		BX24.callMethod(
			"crm.lead.list", 
			{ 
				filter: { "PHONE": "555888" },
				select: [ "ID", "TITLE" ]
			}, 
			function(result) 
			{
				if(result.error())
					console.error(result.error());
				else
				{
					console.dir(result.data());			
					if(result.more())
						result.next();						
				}
			}
		);	
</script>

Example for fetching leads for a month:

$result = CRest::call(
	'crm.lead.list',
	[
		'filter' => [
			'>DATE_CREATE' => '2019-10-01T00:00:00',
			'<DATE_CREATE' => '2019-10-31T23:59:59'
		],
		'select' => [
			'ID',
			'DATE_CREATE'
		]
	]
);

Example for printing next batch of leads.

BX24.callMethod(
	"crm.lead.list",
	{
		order: { "STATUS_ID": "ASC" },
		filter: { ">OPPORTUNITY": 0, "!STATUS_ID": "CONVERTED" },
		select: [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ],
		start: "50"
	},
	function(result)
	{
		if(result.error())
			console.error(result.error());
		else
		{
			console.dir(result.data());
			if(result.more())
				result.next();
		}
	}
); 


© «Bitrix24», 2001-2024