Documentation

Pipelines

General

Previously, pipeline were available only in deals (class \Bitrix\Crm\Category\DealCategory, table \Bitrix\Crm\Category\Entity\DealCategoryTable).

[link=13967440]SPA[/link] pipelines have a [link=13967528]dedicated table[/link].

Pipeline data abstraction was created similar to the abstract for [link=13985532]CRM entity elements[/link].

However, in this case, the complete class \Bitrix\Crm\Category\Entity\Category has a little bit of expanded interface, containing mostly abstract classes.

This is due to the default pipeline data for deals not being stored in a table, but inside b_option, which, accordingly doesn't have EntityObject.

To get objects of this class, you need to query corresponding factory methods.

Methods

Method Description Available from version
abstract public function getId(): ?int;
Returns pipeline ID.
abstract public function getEntityTypeId(): int;
Returns CRM entity type ID.
abstract public function setEntityTypeId
(int $entityTypeId): Category;
Updates CRM entity type ID to $entityTypeId.
abstract public function getName(): string;
Returns pipeline title.
abstract public function setName
(string $name): Category;
Updates pipeline title to $name.
abstract public function getSort(): int;
Returns sorting index.
abstract public function setSort
(int $sort): Category;
Updates sorting index to $sort.
abstract public function 
setIsDefault(bool $isDefault): Category;
Updates flag for the default pipeline.
abstract public function getIsDefault(): bool;
Returns true for a default pipeline.
abstract public function save(): Result;
Saves changes in the database. Returns Bitrix\Main\Result.
abstract public function delete(): Result;
Deletes a pipeline. Returns Bitrix\Main\Result.
public function getData(): array
Returns pipeline data as an array.
public function jsonSerialize(): array
Returns pipeline data prepared for [link=14009348]frontend[/link] or REST.
public function getItemsFilter(array $filter = []): array
Method writes filter into $filter and returns a new filter.

Descendants


This class has several implementations:

  • \Bitrix\Crm\Category\Entity\DealDefaultCategory - pipeline by default for deals.
  • \Bitrix\Crm\Category\Entity\DealCategory - deal pipeline.
  • \Bitrix\Crm\Category\Entity\ItemCategory - SPA pipeline.

Limits


  • Cannot delete default pipeline. Nor for deals, nor for smart processes.
  • Cannot edit the field ENTITY_TYPE_ID for existing SPA pipelines (and for deal pipelines specifically).
  • Default pipelines for SPAs are created automatically at the moment of creating a new SPA.

Example


Edit the default pipeline for deals


use Bitrix\Crm\Service;

$factory = Service\Container::getInstance ()->getFactory(
    \CCrmOwnerType ::Deal
);
$category = $factory->getDefaultCategory ();
$category
    ->setName('Default Category' )
    ->setSort(200)
;
$result = $category->save();


Get list of pipelines


$factory = Service\Container::getInstance ()->getFactory(
    \CCrmOwnerType ::Deal
);

$categoryId = 10;

$categories = $factory->getCategories();
$category = $factory->getCategory($categoryId);

© «Bitrix24», 2001-2024