MngValidateWorkflowRule¶
Validates a workflow rule payload without saving the rule and without executing actions.
Access¶
Manager sessions: SESSION_MANAGER, SESSION_ADMIN, SESSION_DEALER, SESSION_CRM_MANAGER, SESSION_CRM_ADMIN.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
trigger |
string | Yes | Trigger code |
conditions |
array/string | No | Flat AND conditions. Default [] |
actions |
array/string | Yes | Action objects |
id |
int | No | Id of the saved rule being edited. Provider actions the rule already has unchanged are then accepted while their provider is offline |
Each action must contain type and params. For operators except exists and not_exists, condition value is required.
Request¶
{
"command": "MngValidateWorkflowRule",
"extID": "1",
"data": {
"trigger": "deposit.created",
"conditions": [
{ "field": "amount_usd", "op": ">=", "value": 50000 }
],
"actions": [
{
"type": "kyc.require_step",
"params": {
"step_code": "source_of_funds",
"level": 3
}
}
]
}
}
Response Data¶
{
"valid": true
}
Invalid rule response:
{
"valid": false,
"error": "ACTION_NOT_ALLOWED_FOR_TRIGGER: customer.webhook_send"
}
Provider Action Errors¶
Actions registered by Moleculer modules are checked against the provider description; see Workflow provider actions.
| Error | Meaning |
|---|---|
ACTION_NOT_ALLOWED_FOR_TRIGGER: <code> |
The provider action is not bound to this trigger |
INVALID_ACTION_PARAMS: <code>.<param> ... |
A param is missing, of a wrong type, outside enum_values, bounds or max_length |
PROVIDER_NOT_REGISTERED: <code> |
The provider is offline and the action is not already in the rule passed by id |
ACTION_NOT_REGISTERED: <code> |
The provider no longer declares the code and the action is not already in the rule |
Condition Value Errors¶
Conditions on a bits field are validated against the flag dictionary. Each of
these codes carries the offending field name after a colon, for example
CONDITION_VALUE_EMPTY_MASK: customer.lifecycle_flags.
| Code | When |
|---|---|
CONDITION_VALUE_TYPE |
The condition value is not an integer |
CONDITION_VALUE_EMPTY_MASK |
The mask is zero |
CONDITION_VALUE_UNKNOWN_FLAG |
The mask contains a bit outside the dictionary |
Conditions on customer.country and account.country take an ISO 3166-1
alpha-2 country code in upper case, for example "DE"; in and not_in take
a non-empty array of such codes. Only the format is checked, not membership in a
country list. A country name such as "Germany" or a lower-case code is refused:
the stored country is compared exactly and such a rule would never match.
| Code | When |
|---|---|
CONDITION_VALUE_EMPTY_LIST |
in or not_in with a value that is not an array or is empty |
CONDITION_VALUE_NOT_ALLOWED |
The value, or an item of the array, is not two upper-case Latin letters |
Invalid country response:
{
"valid": false,
"error": "CONDITION_VALUE_NOT_ALLOWED: customer.country"
}
The same codes are returned by MngTestWorkflowRule, MngAddWorkflowRule, and MngUpdateWorkflowRule.