Documentation

Stage progress history

Description

crm.stagehistory.list(
   {
      entityTypeId: number,
      order: ?{} = null,
      filter: ?{} = null,
      select: ?{} = null,
      start: ?number = 0
   }
)

Method supports retrieval of stage progress history for deals, leads and invoices.

Parameters

Parameter Description Available from version
entityTypeId Entity type ID. Can have the following values:
  • 1 - lead
  • 2 - deal
  • 5 - invoice
order List for sorting, where key - field , value - ASC or DESC
filter List for filtering. Filter supports usage of precise values, value arrays, as well as modifiers =, !=, <, >, >=, <=. Search by "like" is not supported.
start Shift for page navigation. Page navigation logic is standard for REST list methods.

Returned value

Method returns array with history records:

{
    "items": []
}

Each array item - array with keys:

  • ID - record ID
  • TYPE_ID - record type. Can have the following values: 1 - create entity, 2 - move to an intermediary stage, 3 - move to a final stage
  • OWNER_ID - entity ID, with updated stage
  • CREATED_TIME - stage date and time

In addition, specific fields exist for different types of entities:

  • for leads and invoices, its
    • STATUS_SEMANTIC_ID - status semantics P - intermediary stage,
      S - successful stage,
      F - failed stage
      (stages).
    • STATUS_ID - status (stage) ID
  • for deals, its
    • CATEGORY_ID - pipeline ID (funnel)
    • STAGE_SEMANTIC_ID - status semantics P - intermediary stage,
      S - successful stage,
      F - failed stage
      (stages).
    • STAGE_ID - stage ID

Example

Getting stage progress history for a deal with ID=1

BX24.callMethod(
    "crm.stagehistory.list", 
    { 
        entityTypeId: 2,
        order: { "ID": "ASC" },
        filter: { "OWNER_ID": 1 },
        select: [ "ID", "STAGE_ID", "CREATED_TIME" ]
    }, 
    function(result) 
    {
        if(result.error())
            console.error(result.error());
        else
        {
            console.dir(result.data());
            if(result.more())
                result.next();
        }
    }
);

© «Bitrix24», 2001-2024