Documentation

crm.quote.add

Scope: catalog Permissions to execute: for all

crm.quote.add(fields)

Creates a new estimate. When the estimate must include buyer/seller requisite details (one company can have multiple details), use the method crm.requisite.link.register.

The created estimate must specify seller and buyer companies:
COMPANY_ID, when the buyer is a company or CONTACT_ID when the buyer is a contact.
MYCOMPANY_ID - seller.

The identifiers, specified in crm.requisite.link.register and in the created estimate must match with buyer and seller.

Parameters

Parameter Description
fields Set of fields - is array ("field"=>"value"[, ...]), containing values of estimate fields, where "field" can have values, returned by the crm.quote.fields method.
Note: to find out the required field format, execute the method crm.quote.fields to view the retrieved field format.

Example

BX24.callMethod(
	"crm.quote.add", 
	{
		fields:
		{ 
			"TITLE": "Draft", 
			"STATUS_ID": "DRAFT",
			"OPENED": "Y", 
			"ASSIGNED_BY_ID": 1, 
			"CURRENCY_ID": "USD", 
			"OPPORTUNITY": 5000,
			"COMPANY_ID": 1,
			"COMMENTS": "New quote.",
			"BEGINDATE": "2016-03-01T12:00:00",
			"CLOSEDATE": "2016-04-01T12:00:00"
		}
	}, 
	function(result) 
	{
		if(result.error())
			console.error(result.error());
		else
			console.info("Quote with ID is created" + result.data());
	}
);	


© «Bitrix24», 2001-2024