Documentation

crm.deal.recurring.update

Scope: catalog Permissions: all

crm.deal.recurring.update(id, fields)

The method updates existing setting for recurring deal template.

Parameters

Note: to find out the required field format, execute the method crm.deal.recurring.fields to view the retrieved field format.
Parameter Description
id Setting ID of recurring deal.
fields Set of fields - array("updated field"=>"value"[, ...]) type, where "updated field" can have values returned by the method crm.deal.recurring.fields.

Example:

   var current = new Date();
   var nextYear = new Date();
   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();
   };

   var id = prompt("Enter ID");
   BX24.callMethod(
       "crm.deal.recurring.update",
       {
           id: id,
           fields:
           {
               "CATEGORY_ID": "2",
               "START_DATE": date2str(nextMonth),
               "PARAMS": {
                   "MODE": "single",
                   "SINGLE_BEFORE_START_DATE_TYPE": "day",
                   "SINGLE_BEFORE_START_DATE_VALUE": 5,
                   "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(result.data());
           }
       }
   );


© «Bitrix24», 2001-2024