Documentation

crm.invoice.recurring.add

crm.invoice.recurring.add(fields)

The method adds new setting for recurring invoice.

Parameters

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());
       }
   );


User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2021, «Bitrix Inc.», 2021
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.