crm.invoice.recurring.add
Scope: catalog Permissions to execute: for all
crm.invoice.recurring.add(fields)
The method adds new setting for recurring invoice.
Parameters
Parameter | Description |
---|---|
fields | Set of fields - array ("field"=>"value"[, ...]) type, containing setting field values for recurring invoice. Required field is INVOICE_ID [invoice ID with specified parameter IS_RECURRING=Y].
Note: to find out the required field format, execute the method crm.invoice.recurring.fields to view the retrieved field format.
|
Example:
var current = new Date(); var nextMonth = new Date(); nextMonth.setMonth(current.getMonth() + 1); var date2str = function(d) { return d.getFullYear() + '-' + paddatepart(1 + d.getMonth()) + '-' + paddatepart(d.getDate()) + 'T' + paddatepart(d.getHours()) + ':' + paddatepart(d.getMinutes()) + ':' + paddatepart(d.getSeconds()) + '+03:00'; }; var paddatepart = function(part) { return part >= 10 ? part.toString() : '0' + part.toString(); }; BX24.callMethod( "crm.invoice.recurring.add", { fields: { "INVOICE_ID": "10", "IS_LIMIT": "N", "START_DATE": date2str(nextMonth), "PARAMS": { "PERIOD": "day", "IS_WORKING_ONLY": "N", "INTERVAL": 30, "DATE_PAY_BEFORE_OFFSET_TYPE": "month", "DATE_PAY_BEFORE_OFFSET_VALUE": 1, } } }, function(result) { if(result.error()) console.error(result.error()); else console.info("Added recurring invoice settings. Record ID - " + result.data()); } );
© «Bitrix24», 2001-2024