Document and line rules
Assignment rules decide where an invoice is posted – which G/L account, item or other target, which posting groups and which dimensions. You set them up once per vendor, and Apply Assignment Rules fills the invoice lines from them for every document of that vendor that follows.
Each vendor has two sets of rules:
- Document rules look at the incoming document as a whole. When one matches, the whole invoice is posted as one line to what the rule says – for example a phone bill that always goes to the same account, however many lines it has.
- Line rules look at each invoice line on its own. When one matches, that line is assigned – for example freight lines to the freight account, and the vendor's article numbers to your items.
Open the rules
- On the Vendor Card: Assignment Rules › Document Assignment Rules or Line Assignment Rules.
- On the Incoming Document: Edit Document Rules or Edit Line Rules. They open the rules of the vendor in Vendor No., so the document needs a vendor first.
What a rule says
Every row in the rule editor is one rule:
| Column | Meaning |
|---|---|
| Condition | When the rule applies – see Conditions below. Leave it empty and the rule applies to everything. |
| Type | The target type: G/L Account, Item, Resource, Fixed Asset, Charge (Item) or Allocation Account. |
| No. | The account, item or other record of that type. The lookup follows the type. |
| Gen. Bus. Posting Group, Gen. Prod. Posting Group, VAT Bus. Posting Group, VAT Prod. Posting Group | Posting groups to set on the line. |
| One column per shortcut dimension | Dimension values to set on the line. Only the shortcut dimensions set up in your company appear, under the name Business Central shows for them, and only values you can post to are offered. |
Posting groups and dimensions are only written when the rule fills them in. Leave them empty and the line keeps what the item or account brings along by default.
Conditions
The condition is a SmartFilter, built with the same builder as in the AutoFlow flow editor. The values it can compare are the fields of the incoming document (for document rules) or of the invoice line (for line rules), offered as SmartFields – the field name without spaces or punctuation, so Vendor Item No. becomes {{VendorItemNo}}.
Some examples:
| Rule set | Condition | Matches |
|---|---|---|
| Line rules | {{Description}} ~ Freight | every line whose description contains Freight |
| Line rules | {{VendorItemNo}} = 4711 | the lines for the vendor's article 4711 |
| Document rules | {{AmountInclVAT}} < 50 | invoices under 50 in total |
| Either | (empty) | everything – use it as the last rule, as a fallback |
The rules are checked from top to bottom, and the first rule that matches wins. Put specific rules first and general ones after them. Drag rows to change the order.
How the rules are applied
Apply Assignment Rules runs the flow published on When applying incoming document rules. The usual order is:
- Document rules first. If one matches, all lines of the document are merged into one line and that line is assigned. The line rules are not looked at.
- Otherwise the line rules, line by line. Each line gets the first line rule that matches it. A line that already has a Target No. is left alone, so what you or an earlier step of the flow assigned is kept.
Lines that no rule matches stay unassigned. Assign them by hand, or add a rule for them so the next invoice is assigned automatically.
Merging needs all lines to have the same VAT %. A document rule is therefore best suited to vendors whose invoices use a single VAT rate.