Documentation

crm.contact.add

Scope: crm Permissions: for all

crm.contact.add(fields, params)

Creates and adds a new contact.

Parameters

Note: to find a required field format, execute the method crm.contact.fields and view the format for fetched values for these fields.
Parameter Description
fields Set of fields - is an array ("field"=>"value"[, ...]) containing values of the contact fields.
params Set of parameters. REGISTER_SONET_EVENT - registers contact adding event in the activity stream. Additionally, notification will be sent to the responsible for the contact..

One of the fields: NAME or LAST_NAME is required to be filled out.

Example

<script type="text/javascript">
	BX24.callMethod(
			"crm.contact.add", 
			{
				fields:
				{ 
					"NAME": "John", 
					"SECOND_NAME": "Lancelot", 
					"LAST_NAME": "Doe", 
					"OPENED": "Y", 
					"ASSIGNED_BY_ID": 1, 
					"TYPE_ID": "CLIENT",
					"SOURCE_ID": "SELF",
                                        "PHOTO": { "fileData": document.getElementById('photo') },
			                "PHONE": [ { "VALUE": "555888", "VALUE_TYPE": "WORK" } ] 	
		},
		params: { "REGISTER_SONET_EVENT": "Y" }	
	}, 
	function(result) 
	{
		if(result.error())
			console.error(result.error());
		else
					console.info("Created a new contact; ID=" + result.data());
			}
		);		
</script>


© «Bitrix24», 2001-2024