Documentation

crm.deal.update

Scope: crm Permissions: for all

crm.deal.update(id, fields)

Updates the specified (existing) deal.

Parameters

Note: to find out the required field format, execute the method crm.deal.fields to view the retrieved field format.
Parameter Description
id Deal ID.
fields Specifies an array of the fields to update ("updated field"=>"value"[, ...], see the example below). Each field can be one of those returned by crm.deal.fields.
params Set of parameters. REGISTER_SONET_EVENT - register deal modification event in the activity stream. Additionally, notification will be sent to the responsible for the company..

Example

<script type="text/javascript">
	var id = prompt("Enter the deal ID");
		BX24.callMethod(
			"crm.deal.update", 
			{ 
				id: id,
				fields:
				{ 
					"STAGE_ID": "NEGOTIATION",  
					"PROBABILITY": 70
				}				
			}, 
			function(result) 
			{
				if(result.error())
					console.error(result.error());
				else
				{
					console.info(result.data());						
				}
			}
		);	
</script>

Method clarifications

To manage deal contacts, it is recommended to use multiple field CONTACT_IDS:

Example

BX24.callMethod("crm.deal.update", { id: 1, fields: { "CONTACT_IDS": [ 1, 2, 3 ] } });

As a result, the deal will be linked with three specified contacts.

Field CONTACT_ID is an outdated field and is supported to enable reverse compatibility.

Example

BX24.callMethod("crm.deal.update", { id: 1, fields: { "CONTACT_ID": 4 } });

As a result of this call, the link with the specified contact will be added to the deal.

Please, note, that the already existing links with contacts will not be deleted during this process. That is, of the deal was previously associated with Contacts 1, 2, and 3, as a result of the this call, it will be associated with contacts 1, 2, 3 and 4.



© «Bitrix24», 2001-2024
Up