Get the list of templates bizproc.workflow.template.list

Scope: bizproc

Who can execute the method: administrator

This method retrieves a list of business process templates.

Method Parameters

Name
type

Description

SELECT
array

The array contains a list of fields to select.

You can specify only the fields that are necessary.

Default value — ['ID']

FILTER
object

An object for filtering the list of business process templates in the format {"field_1": "value_1", ... "field_N": "value_N"}, where

  • field_Nfield of the template for filtering
  • value_N — field value

You can specify the type of filtering before the name of the filtered field:

  • ! — not equal
  • < — less than
  • <= — less than or equal to
  • > — greater than
  • >= — greater than or equal to

ORDER
object

An object for sorting the list of launched business processes in the format {"field_1": "value_1", ... "field_N": "value_N"}, where

  • field_Nfield of the template for sorting
  • value_N — sorting direction

Sorting direction can take the values:

  • asc — ascending
  • desc — descending

You can specify multiple fields for sorting, for example, {NAME: 'ASC', ID: 'DESC'}.

Default value — {ID: 'ASC'}

start
integer

This parameter is used for managing pagination.

The page size of results is always static — 50 records.

To select the second page of results, you need to pass the value 50. To select the third page of results — the value 100, and so on.

The formula for calculating the start parameter value:

start = (N - 1) * 50, where N — the number of the desired page

Template Fields

Name
type

Description

ID
integer

Identifier of the business process template

MODULE_ID
string

Identifier of the module by document. Possible values:

  • crm — CRM
  • lists — universal lists
  • disk — drive

ENTITY
string

Identifier of the object by document. Possible values:

CRM

  • CCrmDocumentLead — leads
  • CCrmDocumentContact — contacts
  • CCrmDocumentCompany — companies
  • CCrmDocumentDeal — deals
  • Bitrix\Crm\Integration\BizProc\Document\Quote — estimates
  • Bitrix\Crm\Integration\BizProc\Document\SmartInvoice — invoices
  • Bitrix\Crm\Integration\BizProc\Document\Dynamic — SPAs

Lists

  • BizprocDocument — processes in the news feed
  • Bitrix\Lists\BizprocDocumentLists — lists in groups

Drive

  • Bitrix\Disk\BizProcDocument

DOCUMENT_TYPE
integer

Document type. Possible values:
crm:

  • LEAD — leads
  • CONTACT — contacts
  • COMPANY — companies
  • DEAL — deals
  • QUOTE — estimates
  • SMART_INVOICE — invoices
  • DYNAMIC_XXX — SPAs, where XXX — identifier of the SPA

lists:

  • iblock_XXX — information block, where XXX — identifier of the information block

drive:

  • STORAGE_XXX — drive storage, where XXX — identifier of the storage

AUTO_EXECUTE
integer

Auto-execute flag. Can take values:

  • 0 — no auto-execute
  • 1 — execute on creation
  • 2 — execute on modification
  • 3 — execute on creation and modification

NAME
string

Template name

TEMPLATE
array

Array with the description of the template's action structure

PARAMETERS
array

Template parameters

VARIABLES
array

Template variables

CONSTANTS
array

Template constants

MODIFIED
datetime

Date of last modification

IS_MODIFIED
boolean

Whether the template has been modified. Possible values:

  • Y — yes, it has been modified
  • N — no

This option is needed for typical templates of business processes

USER_ID
integer

Identifier of the user who created or modified the template

SYSTEM_CODE
string

System code of the template.

Needed for identifying typical business process templates or templates created by the application

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"select":["ID","NAME","USER_ID","SYSTEM_CODE"],"filter":{"MODULE_ID":"lists","AUTO_EXECUTE":0},"order":{"ID":"DESC"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/bizproc.workflow.template.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"select":["ID","NAME","USER_ID","SYSTEM_CODE"],"filter":{"MODULE_ID":"lists","AUTO_EXECUTE":0},"order":{"ID":"DESC"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/bizproc.workflow.template.list
        
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
        
        const parameters = {
            select: [
                'ID',
                'NAME',
                'USER_ID',
                'SYSTEM_CODE'
            ],
            filter: {
                MODULE_ID: 'lists',
                AUTO_EXECUTE: 0
            },
            order: {
                ID: 'DESC'
            }
        };
        
        try {
            const response = await $b24.callListMethod('bizproc.workflow.template.list', parameters);
            const items = response.getData() || [];
            for (const entity of items) { console.log('Entity:', entity); }
        } catch (error) {
            console.error('Request failed', error);
        }
        
        // fetchListMethod: Retrieves data in parts using an iterator. Use it for large data volumes to optimize memory usage.
        
        try {
            const generator = $b24.fetchListMethod('bizproc.workflow.template.list', parameters, 'ID');
            for await (const page of generator) {
                for (const entity of page) { console.log('Entity:', entity); }
            }
        } catch (error) {
            console.error('Request failed', error);
        }
        
        // callMethod: Manually controls pagination through the start parameter. Use it for precise control of request batches. For large datasets, it is less efficient than fetchListMethod.
        
        try {
            const response = await $b24.callMethod('bizproc.workflow.template.list', parameters, 0);
            const result = response.getData().result || [];
            for (const entity of result) { console.log('Entity:', entity); }
        } catch (error) {
            console.error('Request failed', error);
        }
        
try {
        	$result = $serviceBuilder
        		->getBizProcScope()
        		->template()
        		->list(
        			['ID', 'MODULE_ID', 'ENTITY', 'DOCUMENT_TYPE', 'AUTO_EXECUTE', 'NAME', 'TEMPLATE', 'PARAMETERS', 'VARIABLES', 'CONSTANTS', 'MODIFIED', 'IS_MODIFIED', 'USER_ID', 'SYSTEM_CODE'],
        			[]
        		);
        	foreach ($result->getTemplates() as $template) {
        		print("ID: " . $template->ID . "\n");
        		print("MODULE_ID: " . $template->MODULE_ID . "\n");
        		print("ENTITY: " . $template->ENTITY . "\n");
        		print("DOCUMENT_TYPE: " . json_encode($template->DOCUMENT_TYPE) . "\n");
        		print("AUTO_EXECUTE: " . ($template->AUTO_EXECUTE ? $template->AUTO_EXECUTE->value : 'null') . "\n");
        		print("NAME: " . $template->NAME . "\n");
        		print("TEMPLATE: " . json_encode($template->TEMPLATE) . "\n");
        		print("PARAMETERS: " . json_encode($template->PARAMETERS) . "\n");
        		print("VARIABLES: " . json_encode($template->VARIABLES) . "\n");
        		print("CONSTANTS: " . json_encode($template->CONSTANTS) . "\n");
        		print("MODIFIED: " . ($template->MODIFIED ? $template->MODIFIED->format(DATE_ATOM) : 'null') . "\n");
        		print("IS_MODIFIED: " . ($template->IS_MODIFIED ? 'true' : 'false') . "\n");
        		print("USER_ID: " . $template->USER_ID . "\n");
        		print("SYSTEM_CODE: " . $template->SYSTEM_CODE . "\n");
        		print("\n");
        	}
        } catch (Throwable $e) {
        	print("Error: " . $e->getMessage() . "\n");
        }
        
BX24.callMethod(
            'bizproc.workflow.template.list',
            {
                select: [
                    'ID',
                    'NAME',
                    'USER_ID',
                    'SYSTEM_CODE'
                ],
                filter: {
                    MODULE_ID: 'lists',
                    AUTO_EXECUTE: 0
                },
                order: {
                    ID: 'DESC'
                }
            },
            function(result)
            {
                if(result.error())
                    alert("Error: " + result.error());
                else
                    console.log(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'bizproc.workflow.template.list',
            [
                'select' => [
                    'ID',
                    'NAME',
                    'USER_ID',
                    'SYSTEM_CODE'
                ],
                'filter' => [
                    'MODULE_ID' => 'lists',
                    'AUTO_EXECUTE' => 0
                ],
                'order' => [
                    'ID' => 'DESC'
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": [
                {
                    "ID": "525",
                    "NAME": "Display Time",
                    "USER_ID": "503",
                    "SYSTEM_CODE": "rest_app_5"
                },
                {
                   "ID": "379",
                   ... 
                }
                ...
            ],
            "total": 34,
            "time": {
                "start": 1737535822.539526,
                "finish": 1737535822.564579,
                "duration": 0.025053024291992188,
                "processing": 0.0019738674163818359,
                "date_start": "2025-01-22T11:50:22+02:00",
                "date_finish": "2025-01-22T11:50:22+02:00",
                "operating_reset_at": 1737536422,
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
object

The root element of the response.

Contains an array of objects with information about business process templates.

Each object contains fields of the template specified in the SELECT parameter

total
integer

Total number of records found

time
time

Information about the execution time of the request

Error Handling

HTTP status: 400

{
            "error": "ACCESS_DENIED",
            "error_description": "Access denied!",
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Possible Error Codes

Code

Error Message

Description

ACCESS_DENIED

Access denied!

The method was not executed by an administrator

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning