When an event happens and the record passes the condition, Elbuz runs the rule's commands in turn: email or SMS, a new document, field changes, a call to an external service.
When you need this:
- A customer needs a message — via your mailbox or SMS gateway.
- An order needs an invoice — “Create document” copies it into another type with all items and can post it.
- Data must go to another system — “Perform HTTP request” sends the record's fields out.
- A manager needs a reminder — “Add task” puts a card on an organizer board.
Where to start: rule card → third section → “Add a command”.
What commands can do
- Eleven commands — email, SMS, task, creating and changing a contact, document or organization, HTTP request, flow.
- Field values — a fixed value or a formula the app calculates for each record.
- Posting — the rule posts or unposts a document, and stock moves just as with manual posting.
- HTTP request — record data via macros in the request body, a token, Basic Auth, and mapping the response to fields.
- Running a flow — a background run with protection against endless loops.
- Email and SMS — sent through your own connections; a failure shows up in the log.
What each of the eleven commands does
You add commands in the third section of the rule card with the button whose tooltip reads “Add a command”. One rule can have several commands; their order is set by the “Execution order” column.
| Command | What it does | What you need beforehand |
|---|---|---|
| Send mail | an email from a template that is created together with the command | a configured mail server |
| Send SMS | an SMS to the phone number from the document, or from the contact card if the document has none | a connected SMS gateway; otherwise the command fails right away |
| Create contact | a new contact card; not created without a name | — |
| Add task | a card on an organizer board, linked to the event's record | at least one enabled board with a column |
| Change contact data | changes the contact the record belongs to | — |
| Create document | a copy of the current document in another type, with all items | the target document type must be set in the command's items |
| Change document data | changes the event's document | — |
| Create organization | a new organization; if one already exists (with the same external , or the same name if no ID is set), it takes the existing one; puts it in the “Recipient company” field of the event's document; not created without a name | — |
| Change organization data | changes the company from the event's context | — |
| Perform HTTP request | a call to a third-party service with the record's data | the external service's URL |
| Run flow | starts a flow in the background with the event's data | a created and enabled flow |
1
List of 11 commands2
Execution order- The expanded list holds eleven commands; one rule can have several of them.
- The Execution order column sets the sequence in which the commands run.
How field values are set
Commands that change or create something are set up with the same builder as the condition, but it reads differently: the field on the left, the value to write on the right. The operator in the middle isn't used at all in this mode — the app takes only the “field — value” pair.
A value can be a formula: anything that starts with @ is calculated — @if, @calc, @concat, @json, @field. Syntax, data sources and ready-made formulas are in the article formulas in triggers.
Two fields behave differently. In “Change document data” and “Create document”, an item with the posting field doesn't write a value — it actually posts the document (about posting). And in “Create document”, an item with the document type field sets which type to copy into; without it nothing is created.
How a rule posts a document
In “Change document data”, the app first writes all the other fields of the command and only then posts or unposts the document. Posting uses the same mechanism as manual posting and happens when the command runs — that is, inside the save that raised the event.
- Action or result
- Decision: the path depends on the answer
What happens to stock levels
What happens to stock depends on the document type. In the standard set of types:
- “Purchase invoice” adds the quantity to the receiving warehouse;
- “Sales invoice”, “Return to supplier” and “Write-off” deduct from the sending warehouse;
- “Stock transfer” deducts from one warehouse and adds to another;
- “Customer order” doesn't move stock, but a posted order reserves the goods — if “Own warehouse” or “Supplier / wholesale” is selected in the document “Working scheme”.
Availability isn't checked before deducting: if the item isn't in stock, the balance goes negative. If the document type works with a warehouse and the required warehouse isn't filled in, posting doesn't happen and the command gets “Failed!”. If the document is already in the requested state — already posted or already unposted — nothing happens.
A “Sales invoice” created from an order adds the shipped quantity to that order's items when posted — if “Supplier / wholesale” is selected in the “Working scheme”.
You can unpost manually or with a rule — value 0 in the posting field of “Change document data”. Both reverse the movement: receipts leave stock, deducted and transferred goods return, the order's reservation is recalculated, the source order's shipped quantity goes down (reservation and shipment under the same “Working scheme” conditions).
Posting and unposting leave an entry in the document history. One exception: with batch accounting enabled, unposting a write-off doesn't return the deducted batches.
If the warehouse isn't filled in (or it's a transfer to the same warehouse), the other fields of the command are already written by then. The rule doesn't set the “done” mark in this case, so on the next event on this document the command tries again and overwrites the same fields.
Posting from a rule doesn't raise the “Document: post (sign)” event: rules waiting for that event won't fire on such posting.
In “Create document”, “Yes” in the posting field posts the new document once it's created and the command's fields are written. The log doesn't show the result: if the new document couldn't be posted (say, it has no warehouse), it stays unposted, and the log line is the same as after success — with the created document's number.
The command still counts as done — the document was created, and the next event won't create it again. So check in the document itself whether the new document was posted; post an unposted one manually. “No” in this command leaves posting alone.
How to send data to another service: HTTP request
The form has five blocks. First comes “Token retrieval settings” — it's collapsed and most people don't need it: it's a separate preliminary request, after which {token} in parameters and headers is replaced with the value received.
The request itself is in the second block, “Data sending settings”: type GET, POST, PUT, PATCH or DELETE; URL; body FORM, or TEXT; parameters; headers. Then “HTTP authorization (Basic Auth)” with login and password, “Data saving settings” (response mapped to document or contact fields) and “Additional” with “Successful response status codes” — 200 by default.
The record's own data is inserted with macros — that's usually the reason for the request. In the RAW field, just type an opening curly brace and the app shows a list of document, contact and company fields in plain form: {Document: Document number}, {Contractor: Phone}.
The short form of the same macros is {{d.field}} for the event's document, {{pc.field}} for its contact and {{cn.field}} for the company. They work in the request body and in parameter values; headers have no macros — only {token} is replaced there.
Body and parameters are either-or: if the RAW field is filled in, parameters aren't sent at all.
The URL is checked before every request. Only http and https are allowed; localhost, .local domains, internal and reserved network addresses, and names that couldn't be resolved to an address are blocked.
The app follows redirects on its own, no more than five in a row, and checks each next URL the same way.
- Action or result
- Decision: the path depends on the answer
How to run a flow
The only command that doesn't run on the spot: the rule creates a background run and moves on. Events don't start a disabled flow. Loop protection: an event won't start the same flow for the same document or contact more than 3 times in 10 minutes — the fourth attempt is rejected and logged.
Where emails and SMS are sent from and who pays for them
The commands themselves charge nothing to your Elbuz balance: emails and SMS go through your own connections, and you pay at the rates of your mail service or SMS gateway.
- Email is sent from the mailbox selected in the email template. If the template has no mailbox, the app takes the enabled default mailbox, and if there's none — the first enabled one with server, login, password and sender address filled in. If none is found, or the recipient, subject or text is empty, the email isn't sent: the log shows “Email not sent: no usable mailbox or required fields are empty” with a list of what's missing, and the command is marked “Failed!”.
- SMS is sent on behalf of your account with the SMS gateway — using the login and password from the gateway settings. The phone number comes from the document: first the main one, then the payer's, then the recipient's. If all three are empty — from the contact card, trying the first, second and third phone in turn.
- The email language is chosen by the app: first the recipient's language, then the store's language, and if the template is filled in only one language — that one.
You can see how much was spent in your mail service or SMS gateway account. Elbuz has no separate spending counter; the number of messages sent is counted by lines in the “Operation log”.
The command counts as done only if the SMS service accepted the message. On refusal (no funds, wrong number, blocked sender) the “Operation log” shows “Failed!” with the service's reason. Same if no SMS service is selected, the template is empty or no phone was found. All sends and errors are also logged in the “Рассылка SMS” (SMS sending) window.
What to do when a command fails
| What you see | Why | What to do |
|---|---|---|
| The “Send SMS” command is marked “Failed!” in the log every time | No SMS service is selected, or it refused — the reason is in the log next to the mark | “External services and integrations” → “Рассылка SMS” (SMS sending): choose a service, enter the key and click “Send test”. More: how to send SMS to customers |
| The HTTP request isn't sent, the response says “blocked” | The URL failed the check: wrong protocol, an internal network address, or a name that couldn't be resolved | Use an external http or https URL (about the HTTP request) |
| The flow from the “Run flow” command didn't start | The same flow was already started by an event for this record 3 times in 10 minutes, and the loop protection kicked in | Break the chain: remove the command that raises the same event again (about running a flow) |
FAQ
Can one rule both send an email and change the status?
Yes. A rule can have several commands; they run one by one in the “Execution order” column order.
Is record data inserted into HTTP request headers?
No. Macros work in the request body and in parameter values; in headers only the token from the preliminary request is replaced (about the HTTP request).
Do rules fire on a document created by another rule?
No. A document created by a command doesn't raise its own events, so rules on “Document: add” won't fire on it.
Can I create a document on a contact event?
No. “Create document” copies the event's document, and a contact event has nothing to copy.
Will “Create contact” make a duplicate if the customer already exists?
No. The command looks for a card with the same email, or without an email — with the same name. If it finds one, no new card is created and the command counts as done.
Where it is and who has access
- Rule commands
- rule card → third section “Command” → “Add a command”
- Command settings
- the pencil in the command row
- Access right
- the “Automatic rules” window (all entry points)
- Prepare
- a mailbox, SMS gateway, organizer board or flow — depending on the command
Related topics
- If you need the big picture — how automatic rules work.
- If a field value has to be calculated from an amount or put together from fields — formulas in triggers.
- If a command is marked “Failed!” in the log — how to test a rule.
- If the SMS gateway isn't connected yet — how to send SMS to customers.
