Documentation

Add

integer
CCrmActivity::Add(
array arFields,
bool checkPerms = true, 
bool regEvent = true, 
array options
);

Adds new activity. Static method.

Call parameters

ParameterDescriptionAvailable from version
arFieldsArray of activity parameters; contains the following fields:
  • TYPE_ID - activity type numeric ID.
    Reference class \CCrmActivityType describes 4 standard activity types, available previously (Meeting, Call, Task, Email). New activities must have the type \CCrmActivityType::Custom.
  • PROVIDER_ID - provider string ID.
    Registered provider ID. Must consist of module and entity name, for example VOXIMPLANT_CALL.
  • PROVIDER_TYPE_ID - provider's activity type string ID.
    Activity type ID within provider activity. (When one provider generates custom activity subtypes).
  • BINDINGS - array of bindings to CRM entities.
    At least one binding to CRM entity must be specified.
    $arFields['BINDINGS'][] = array(
       'OWNER_ID' => $crmEntity['ENTITY_ID'],
       'OWNER_TYPE_ID' => $crmEntity['ENTITY_TYPE']
    );
  • ASSOCIATED_ENTITY_ID - entity ID, that generates an activity (when available). Numeric value.
    For example, for Task-type activities, this value stores the task ID.
  • SUBJECT - activity topic (Name).
    "Outbound call with John".
  • COMPLETED - activity completed flag (Y/N).
    Used, when an activity has status "activity completed", "activity not completed".
  • RESPONSIBLE_ID - responsible user ID.
    ID of the user, who is assigned as responsible for the activity completion.
  • PRIORITY - numeric ID for activity priority.
    The value is sourced from the reference class \CCrmActivityPriority. New planner only has the "Important activity" mark; that's why it is recommended to use either \CCrmActivityPriority::Medium or \CCrmActivityPriority::High.
  • NOTIFY_TYPE - notification type numeric ID.
    Values are sourced from \CCrmActivityNotifyType. Minutes, hours, days.
  • NOTIFY_VALUE - notification numeric value.
    In many minutes (hours, days), a reminder must be sent for this activity.
  • DESCRIPTION - description, text.
    "Activity description" field.
  • DESCRIPTION_TYPE - type of description.
    Value from the reference class \CCrmContentType (PlainText, BBCode, Html).
  • DIRECTION - direction.
    Reference \CCrmActivityDirection. Incoming and outgoing activities are available.
  • LOCATION - location, text.
    Presently, used in the Meeting activity type.
  • START_TIME - activity start date (datetime).
  • END_TIME - activity end date (datetime).
    Set for the activities with long duration.
  • STORAGE_TYPE_ID - type of storage for attachments.
    Default storage CCrmActivity::GetDefaultStorageTypeID().
  • STORAGE_ELEMENT_IDS - array of attachment IDs.
    Array with object IDs of specified storage type.
  • PARENT_ID - Parent activity ID.
    Presently, used in the Email-type activity. Used to build activity chain.
  • AUTHOR_ID - creator ID.
    ID of the user, who created an activity.
  • ORIGINATOR_ID - external database ID.
    Used to communicate with external entities.
  • ORIGIN_ID - original entity ID in the external database.
    Used to establish association with external entities (i.e., Voximplant).
  • PROVIDER_PARAMS - array of provider parameters.
    Reserved text field for provider parameters. Accepts only an array.
  • PROVIDER_DATA - provider data in arbitrary type (longtext).
    Reserved text field for provider data.
  • RESULT_VALUE - number (format 18.4).
    activity importance index, to calculate communication load. Each type of activity can have an individual index. For example, for calls: call duration.
  • RESULT_SUM - number (format 18.4).
    sum of funds.
  • RESULT_CURRENCY_ID - string (3 symbols).
    Currency code for sum of funds.
checkPermsThis parameter checks access permissions for an activity. Can have values true or false.
regEvent This parameter registers an activity in the CRM history. Can have values true or false.
optionsArray of additional parameters, contains the following fields:
  • SKIP_CALENDAR_EVENT - do not add entry to the Calendar.
    true or false.
  • REGISTER_SONET_EVENT - create an entry in the Activity Stream.
    true or false.
from version 12.0.7

Returned values

Returns ID of created activity.

Examples

$ID = CCrmActivity::Add($arFields, false, true, array('REGISTER_SONET_EVENT' => true));
if($ID > 0)
{
   CCrmActivity::SaveCommunications($ID, $arComms, $arFields, true, false);
}


© «Bitrix24», 2001-2024
Up