Documentation

crm.activity.type.add

Scope: catalog Permissions to execute: for all

Method registers an activity subtype with specified name and icon.

Parameters

Parameter Description Available from version
TYPE_ID Provider activity type (when creating activity its PROVIDER_TYPE_ID)
NAME Name for your current activity type
ICON_FILE Icon file for your activity type

Example

BX24.callMethod(
   'crm.activity.type.add',
   {
      fields:
         {
            "TYPE_ID": 'RegAC',
            "NAME": "RegAC 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 this, you need only to indicate a custom type when creating an activity: icon and name will be loaded automatically.

BX24.callMethod(
   'crm.activity.add',
   {
      fields:
         {
            "OWNER_TYPE_ID": 1,
            "OWNER_ID": selectedEntityId,
            "PROVIDER_ID": 'REST_APP',
            "PROVIDER_TYPE_ID": 'RegAC',
            "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());
      }
   }
);

© «Bitrix24», 2001-2024
Up