Skip to content

Latest commit

 

History

History
328 lines (268 loc) · 7.8 KB

statuses.md

File metadata and controls

328 lines (268 loc) · 7.8 KB

Statuses service

API Enum method Bitrix method
bitrix.statuses.create() Method.CRM_STATUS_FIELDS crm.status.fields
Method.CRM_STATUS_ENTITY_TYPES crm.status.entity.types
Method.CRM_STATUS_ENTITY_ITEMS crm.status.entity.items
bitrix.statuses.create() Method.CRM_STATUS_ADD crm.status.add
bitrix.statuses.delete() Method.CRM_STATUS_DELETE crm.status.delete
bitrix.statuses.get() Method.CRM_STATUS_GET crm.status.get
bitrix.statuses.list() Method.CRM_STATUS_LIST crm.status.list
bitrix.statuses.update() Method.CRM_STATUS_UPDATE crm.status.update

bitrix.statuses.fields()

List all fields for Status entity

bitrix.statuses.fields()

Returns

  • Promise<GetPayload<Fields>>
See payload example
{
  result: {
    ID: {
      type: "integer",
      isRequired: false,
      isReadOnly: true,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "ID"
    },
    ENTITY_ID: {
      type: "string",
      isRequired: true,
      isReadOnly: false,
      isImmutable: true,
      isMultiple: false,
      isDynamic: false,
      title: "ID элемента сущности"
    },
    STATUS_ID: {
      type: "string",
      isRequired: true,
      isReadOnly: false,
      isImmutable: true,
      isMultiple: false,
      isDynamic: false,
      title: "Статус"
    },
    SORT: {
      type: "integer",
      isRequired: false,
      isReadOnly: false,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "Сортировка"
    },
    NAME: {
      type: "string",
      isRequired: true,
      isReadOnly: false,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "Название"
    },
    NAME_INIT: {
      type: "string",
      isRequired: false,
      isReadOnly: true,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "Название по умолчанию"
    },
    SYSTEM: {
      type: "char",
      isRequired: false,
      isReadOnly: true,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "Системный"
    },
    EXTRA: {
      type: "crm_status_extra",
      isRequired: false,
      isReadOnly: false,
      isImmutable: false,
      isMultiple: false,
      isDynamic: false,
      title: "Дополнительные поля"
    }
  },
  time: {
    start: 1568749081.1406679,
    finish: 1568749081.1696601,
    duration: 0.028992176055908203,
    processing: 0.0014741420745849609,
    date_start: "2019-09-17T22:38:01+03:00",
    date_finish: "2019-09-17T22:38:01+03:00"
  }
}

bitrix.statuses.create()

Create new status

bitrix.statuses.create({
  NAME: 'New status'
})

Arguments

  • fields: Partial<Status> — a fields to create status with. See Status.

Returns

  • Promise<GetPayload<number>>
See payload example
{
  result: 77,
  time: {
    start: 1567372034.625375,
    finish: 1567372034.8204,
    duration: 0.19502496719360352,
    processing: 0.03838515281677246,
    date_start: "2019-09-02T00:07:14+03:00",
    date_finish: "2019-09-02T00:07:14+03:00"
  }
}

bitrix.statuses.delete()

Delete status

bitrix.statuses.delete('1')

Arguments

  • id: stringID of the status to delete.
  • params?.FORCED?: 'Y' | 'N' — setting FORCED parameter to 'Y' allows you to delete system statuses

Returns

  • Promise<GetPayload<boolean>>
See payload example
{
  result: true,
  time: {
    start: 1567372034.625375,
    finish: 1567372034.8204,
    duration: 0.19502496719360352,
    processing: 0.03838515281677246,
    date_start: "2019-09-02T00:07:14+03:00",
    date_finish: "2019-09-02T00:07:14+03:00"
  }
}

bitrix.statuses.get()

Retrieve specified status

bitrix.statuses.get('1')

Arguments

  • id: stringID of the status to retrieve.

Returns

  • Promise<GetPayload<Status>> (See Status)
See payload example
{
  result: [
    {
      ID: "1",
      ENTITY_ID: "STATUS",
      STATUS_ID: "NEW",
      NAME: "Не обработан",
      NAME_INIT: "Не обработан",
      SORT: "10",
      SYSTEM: "Y",
      EXTRA: {
        SEMANTICS: "process",
        COLOR: "#E1E1E1"
      }
    }
  ],
  total: 1,
  time: {
    start: 1567988070.0949659,
    finish: 1567988070.1293139,
    duration: 0.034348011016845703,
    processing: 0.0028300285339355469,
    date_start: "2019-09-09T03:14:30+03:00",
    date_finish: "2019-09-09T03:14:30+03:00"
  }
}

bitrix.statuses.list()

Retrieve all statuses.

bitrix.statuses.list({ filter: { ID: '1' }})

Arguments

  • { order?, filter? }: { Record<string, any>, Record<string, any>} — statuses list accepts only optional order and filter parameters

Returns

  • Promise<ListPayload<Status>>
See payload example
{
  result: [
    {
      ID: "1",
      ENTITY_ID: "STATUS",
      STATUS_ID: "NEW",
      NAME: "Не обработан",
      NAME_INIT: "Не обработан",
      SORT: "10",
      SYSTEM: "Y",
      EXTRA: {
        SEMANTICS: "process",
        COLOR: "#E1E1E1"
      }
    }
  ],
  total: 1,
  time: {
    start: 1567988070.0949659,
    finish: 1567988070.1293139,
    duration: 0.034348011016845703,
    processing: 0.0028300285339355469,
    date_start: "2019-09-09T03:14:30+03:00",
    date_finish: "2019-09-09T03:14:30+03:00"
  }
}

bitrix.statuses.update()

Update specified status

bitrix.statuses.update('77', {
  NAME: 'New status name'
})

Arguments

  • id: string — status ID to update
  • fields: Partial<Status> — a fields to update. See Status

Returns

  • Promise<GetPayload<boolean>>
See payload example
{
  result: true,
  time: {
    start: 1567372034.625375,
    finish: 1567372034.8204,
    duration: 0.19502496719360352,
    processing: 0.03838515281677246,
    date_start: "2019-09-02T00:07:14+03:00",
    date_finish: "2019-09-02T00:07:14+03:00"
  }
}