Documentation

crm.deal.recurring.add

crm.deal.recurring.add(fields)

The method adds new setting for recurring deal.

Parameters

Parameter Description
fields Set of fields - array ("field"=>"value"[, ...]) type containing values of deal fields. Required field - DEAL_ID [deal ID that have IS_RECURRING=Y] parameter specified.

Example

   var current = new Date();
   var nextMonth = new Date();
   var nextYear = new Date();
   nextMonth.setMonth(current.getMonth() + 1);
   nextYear.setYear(current.getFullYear() + 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.deal.recurring.add",
       {
           fields:
           {
               "DEAL_ID": "45",
               "CATEGORY_ID": "1",
               "IS_LIMIT": "D",
               "LIMIT_DATE": date2str(nextYear),
               "START_DATE": date2str(nextMonth),
               "PARAMS": {
                   "MODE": "multiple",
                   "MULTIPLE_TYPE": "month",
                   "MULTIPLE_INTERVAL": 1,
                   "OFFSET_BEGINDATE_TYPE": "day",
                   "OFFSET_BEGINDATE_VALUE": 1,
                   "OFFSET_CLOSEDATE_TYPE": "month",
                   "OFFSET_CLOSEDATE_VALUE": 2,
               }
           }
       },
       function(result)
       {
           if(result.error())
               console.error(result.error());
           else
               console.info("recurring deal settings added. 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-2019, «Bitrix Inc.», 2019