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

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-2020, «Bitrix Inc.», 2020