Documentation

crm.lead.add

Scope: catalog Permissions: all

crm.lead.add(fields)

Creates and adds a new lead.

Parameters

Note: to find out the required field format, execute the method crm.lead.fields to view the retrieved field format.
To create a repeat lead, specify the values of fields COMPANY_ID or CONTACT_ID. After these fields are set, the flag IS_RETURN_CUSTOMER is set automatically.
Parameter Description
fields Set of fields - is an array ("field"=>"value"[, ...]) containing values of the lead fields.
params Set of parameters. REGISTER_SONET_EVENT - register a lead adding events in the activity stream. Additionally, notification will be sent to the responsible for the contact.

Example

<script type="text/javascript">
	BX24.callMethod(
			"crm.lead.add", 
			{
				fields:
				{ 
					"TITLE": "FatJoint LLC", 
					"NAME": "Paul", 
					"SECOND_NAME": "A.", 
					"LAST_NAME": "Nibot", 
					"STATUS_ID": "NEW", 
					"OPENED": "Y", 
					"ASSIGNED_BY_ID": 1, 
					"CURRENCY_ID": "USD", 
					"OPPORTUNITY": 12500,
					"PHONE": [ { "VALUE": "555888", "VALUE_TYPE": "WORK" } ] ,
			                 "WEB": [ { "VALUE": "www.mysite.com", "VALUE_TYPE": "WORK" } ]

				}
			}, 
			function(result) 
			{
				if(result.error())
					console.error(result.error());
				else
					console.info("Created a new lead, ID=" + result.data());
			}
		);			
</script>

Example for HTTPS:

https://adress.com/rest/1/5***/crm.lead.add.json?fields[NAME]=John&fields[SECOND_NAME]=Smith&fields[LAST_NAME]=Administrator&fields[PHONE][0][VALUE]=89994445556&fields[PHONE][0][VALUE_TYPE]=WORK&fields[EMAIL][0][VALUE]=test@goo.com&fields[EMAIL][0][VALUE_TYPE]=WORK 


© «Bitrix24», 2001-2024