crm.contact.update
Scope: catalog Permissions to execute: for all
crm.contact.update(id, fields, params)
Updates the specified (existing) contact.
Important! It is strongly recommended to pass the full set of fields to the update method when updating the address. Specifics of address fields are described here.
Parameters
Parameter | Description |
---|---|
id | Specifies the contact ID. |
fields | An array in format array("field"=>"value"[, ...]) containing values of the contact fields that need to be updated. The fields can be one or more of those returned by crm.contact.fields. |
params | Set of parameters. REGISTER_SONET_EVENT - register a contact update event in Feed. Additionally, sends notification to a person responsible for contact. |
Note: to find out a required field format, execute the method [link=704094]crm.contact.fields[/link] and overview the format for retrieved values for these fields.
Example
<script type="text/javascript"> var id = prompt("Enter ID"); BX24.callMethod( "crm.contact.update", { id: id, fields: { "TYPE_ID": "JOURNALIST", "SOURCE_ID": "CONFERENCE" } }, function(result) { if(result.error()) console.error(result.error()); else { console.info(result.data()); } } ); </script>
To delete one of multiple field values, for example, for EMAIL field, pass ID for this value and zero out VALUE.
BX24.callMethod( "crm.contact.update", { id: 46467, fields: { "EMAIL": [{ "ID": 83153, "VALUE": "" }] } }, function(result) { if (result.error()) console.error(result.error()); else { console.info(result.data()); } } );
© «Bitrix24», 2001-2024