Documentation

crm.activity.type.add

The method registers its activity subtype with assigned name and icon.

Parameters

Parameter Description Available from version
TYPE_ID Provider activity type (set as PROVIDER_TYPE_ID activity is created)
NAME Name of your activity type
ICON_FILE Icon file for your activity type

Example

BX24.callMethod(
   'crm.activity.type.add',
   {
      fields:
         {
            "TYPE_ID": 'Bitrix24',
            "NAME": "Bitrix24 activity",
            'ICON_FILE': document.getElementById('type-icon') // file input node
         }
   },
   function(result)
   {
      if(result.error())
         alert("Error: " + result.error());
      else
      {
         alert("Success: " + result.data());
      }
   }
);

After that, specify only the type when creating an activity. The icon and name will be uploaded automatically.

BX24.callMethod(
   'crm.activity.add',
   {
      fields:
         {
            "OWNER_TYPE_ID": 1,
            "OWNER_ID": selectedEntityId,
            "PROVIDER_ID": 'REST_APP',
            "PROVIDER_TYPE_ID": 'Bitrix24',
            "SUBJECT": "New activity",
            "COMPLETED": "N",
            "RESPONSIBLE_ID": 1,
            "DESCRIPTION": "New activity description"
         }
   },
   function(result)
   {
      if(result.error())
         alert("Error: " + result.error());
      else
      {
         alert("Success: " + result.data());
      }
   }
);

© «Bitrix Inc.», 2001-2021, «Bitrix Inc.», 2021