Documentation

crm.contact.add

crm.contact.add(fields)

Creates and adds a new contact.

Parameters

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>


User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2017, «Bitrix Inc.», 2017