Skip to content

MngGetWorkflowRulesByFilter

Returns workflow rules with filters, sorting and pagination as a table: structure names the columns and every row is an array of values in that order.

Response format changed

Rows are positional arrays read against structure, not objects. Earlier versions returned rows as an array of rule objects. Read every value by the index of its name in structure rather than by a fixed position.

Access

Manager sessions: SESSION_MANAGER, SESSION_ADMIN, SESSION_DEALER, SESSION_CRM_MANAGER, SESSION_CRM_ADMIN.

Request Parameters

Name Type Required Description
brand string No Brand namespace
trigger string No Trigger code
status int No -1 or omitted means all statuses
scope int No 0 CRM, 1 BO, 2 both/all
limit int No Default 100, from 1 to 1000
offset int No Default 0
where array No [[field, operator, value], ...]
orWhere array No OR comparison group in [[field, operator, value], ...] format; at least one condition must match
whereNot array No [[field, value], ...]
whereIn array No [[field, [values...]], ...]
whereNotIn array No [[field, [values...]], ...]
whereBetween array No [[field, [from, to]], ...]
whereNotBetween array No [[field, [from, to]], ...]
orderBy array No One sort column, for example [["priority", "desc"]]. Default: priority descending, then id descending

brand, trigger, status and scope work as before and are combined with where and the other filter groups by AND. Brand and scope are limited by the session first, so filter groups only narrow the visible rules and never widen them.

Fields available in filters and orderBy:

Field Type
id, scope, status, priority, stop_processing int
brand, code, name, trigger string
created_time, updated_time int64, Unix seconds

Operators: =, ==, !=, >, <, >=, <=, like. String comparison is case-insensitive, and string like matches a substring (% characters are ignored); strings support only =, ==, != and like. Integer like matches the decimal digits as a substring. Conditions on other fields, or with a value of another type, do not match. conditions and actions are not filterable. Rows with equal sort values are ordered by id descending.

Scope filtering:

0 = CRM, returns CRM + BOTH rules
1 = BO, returns BO + BOTH rules
2 = BOTH, returns all rules

If scope is omitted, backend infers it from __access.type:

SESSION_CRM_MANAGER / SESSION_CRM_ADMIN -> CRM
SESSION_MANAGER / SESSION_DEALER        -> BO
SESSION_ADMIN                           -> BOTH

This prevents CRM-only workflow chains from appearing in BackOffice UI and BO-only workflow chains from appearing in CRM UI. For non-admin BO/CRM sessions backend always enforces session scope, even if client sends scope = 2.

Request

{
  "command": "MngGetWorkflowRulesByFilter",
  "extID": "1",
  "data": {
    "brand": "brand-a",
    "trigger": "deposit.created",
    "status": 0,
    "scope": 0,
    "limit": 100,
    "offset": 0,
    "where": [
      ["name", "like", "deposit"]
    ],
    "orderBy": [
      ["updated_time", "desc"]
    ]
  }
}

Response Data

Field Type Description
structure string[] Column names, in the order of values in every row
rows array[] Matching rules for the requested page
count int Number of rules matching all filters, before limit and offset

Columns:

Column Type Description
id int Rule ID
brand string Brand namespace
code string Rule code
name string Rule name
scope int 0 CRM, 1 BO, 2 both
status int 0 active, 1 disabled, 2 archived
priority int Higher priority runs first
trigger string Trigger code
conditions array Rule conditions, as stored by MngAddWorkflowRule
actions array Rule actions, as stored by MngAddWorkflowRule
stop_processing int 1 skips lower-priority rules of the same event after this rule matches
created_time int64 Unix seconds
updated_time int64 Unix seconds
unavailable_actions array Actions that will not run right now: [{"index", "type", "reason"}], see MngGetWorkflowRule
{
  "structure": [
    "id",
    "brand",
    "code",
    "name",
    "scope",
    "status",
    "priority",
    "trigger",
    "conditions",
    "actions",
    "stop_processing",
    "created_time",
    "updated_time",
    "unavailable_actions"
  ],
  "rows": [
    [
      1,
      "brand-a",
      "large_deposit_sof",
      "Large Deposit Source Of Funds",
      0,
      0,
      10,
      "deposit.created",
      [
        { "field": "amount_usd", "op": ">=", "value": 10000 }
      ],
      [
        { "type": "kyc.require_step", "params": { "step_code": "source_of_funds" } }
      ],
      0,
      1777600000,
      1777600500,
      []
    ]
  ],
  "count": 1
}