Documentation

crm.activity.update

Scope: catalog Permissions to execute: for all

Starting from CRM version 22.1350.0 this method has been deprecated, please use the method crm.activity.todo.add.

crm.activity.update(id, fields)

Updates the specified (existing) activity.

Parameters

Parameter Description
id Specifies the activity ID.
fields An array in format array("field"=>"value"[, ...]) containing values of the activity fields that need to be updated. The fields can be one or more of those returned by crm.activity.fields.
Note: to find out the required field format, execute the method crm.activity.fields to view the retrieved field format.

Example

	        var d = new Date();
		d.setSeconds(0);	
		var dateStr = d.getFullYear() + '-' + paddatepart(1 + d.getMonth()) + '-' + paddatepart(d.getDate()) + 'T' + paddatepart(d.getHours()) + ':' 
                     + paddatepart(d.getMinutes()) + ':' + paddatepart(d.getSeconds()) + '+00:00';
                var paddatepart = function(part)
                {
                     return part >= 10 ? part.toString() : '0' + part.toString();
                }	
	        var id = prompt("Enter ID");

		BX24.callMethod(
			"crm.activity.update", 
			{ 
				id: id,
				fields:
				{ 
					"START_TIME": dateStr,
					"END_TIME": dateStr,				
					COMPLETED: 'Y'
				}				
			}, 
			function(result) 
			{
				if(result.error())
					console.error(result.error());
				else
				{
					console.info(result.data());						
				}
			}
		);	


© «Bitrix24», 2001-2024