Who this is for. SmartCustomer users with the SuperAdmin role.
Availability. The AR Mapping tab appears in SmartCustomer when AR Mapping is enabled for your organization.
Overview
Rules calculate or fix the values that fields read. They live on the Rules tab of Field mapping, the fifth step of the mapping editor. The tab counts the rules that are on, for example Rules 4.
A rule comes from the customer's Excel formulas, or from a description you write in plain English. When you confirm the table boundaries, the mapping detects rules from the formulas in the samples. On this tab, you add rules and bind them to fields. You can also change, switch off, or delete a rule. To review the fields themselves, see Review the field mappings.
The tab lists the rules in two groups. Shared rules · apply to all customers holds the rules shared with every customer. This customer only holds the rules of this mapping. Each rule is a card with a switch, an edit icon, and a delete icon. For each part of a card, see Rules in Field sources and rules.
Each procedure below says whether its change clears the last test result. The procedures for adding and changing a rule also say whether the change lasts without a save. So do the ones for switching off and deleting a rule. After a change that clears the test, run Test and validate again.
When this step is done, go to Test and activate an AR remittance mapping.
Add a rule from the customer's formulas
When no detected rule covers a calculated value, such as a total, add a rule.
Caution: Improve with AI can change what a rule calculates. On the Northwind Traders sample, it turned a sum of Amount Paid into Sum all Invoice Amount values in table 1. Read the generalized rule again before you save it.
- On Rules, select New rule, then From Excel formulas. Until you load formulas, the form reads No example formulas yet — load them from a sheet below and pick which to use, or type your own.
- Leave Apply to all customers off. The switch reads, for example, Apply to all customers (currently: Northwind Traders only).
- In Rule name, type a name.
- Choose a File and a Sheet. Sheet becomes available after you choose the file.
- Select Load formulas. The list names the file and the sheet, and counts the formulas found, for example 8 formulas.
- Select the formulas to use. all and none select or clear every formula.
- Select Add selected. The button counts your selection, for example Add selected (1). Each added formula has a remove icon, and remove all removes them all.
- To add formulas of your own, type them one per line in the box under the list. Then select Add.
- Select Generalize. It turns the formulas into one editable rule, shown with its scope, such as scope: document. It is marked deterministic, or AI after Improve with AI.
- Review the generalized rule. You can edit its description under GENERALIZED RULE (editable). The form also offers Regenerate rule from description.
- To let AI rewrite the rule, select Improve with AI. The rule is then marked AI, with Generated by AI — review before activating.
- Select Save rule. To leave without a rule, select Cancel.
The rule appears on Rules. Its card says Not bound yet until a field uses it. Without a name, the rule is saved as Untitled rule. A rule you add is kept at once, and adding it clears the last test result.
In Figure 1, generalizing E13=SUM(E8:E12) from the Northwind Traders sample gives For the whole document: the sum of Amount Paid across all line items. The first pass had already detected that rule. Saving this one would add a second rule with the same calculation.
Figure 1. A rule generalized from one Excel formula
Write a rule in plain English
A plain-English rule sets, fills in, or rewrites a value that you describe in words. Use one when no column or formula gives the value you need.
- On Rules, select New rule, then Plain English. The form reads, for example, ENGLISH RULE · Northwind Traders only.
- Leave Apply to all customers off.
- In Rule name, type a name, for example Invoice number from Remarks.
- Under DESCRIBE IT IN PLAIN ENGLISH, describe what the rule should do. Name the column it reads and the value you want.
- Select Build with AI. WHAT IT WILL DO then lists the steps of the rule. For example, it shows WHAT IT WILL DO (1 step) and
regex_extract /(INV-\d+)/. - Check the steps. If a message appears instead, reword the description and select Build with AI again.
- Select Save rule. To leave without a rule, select Cancel.
The rule appears on Rules, marked English. A rule that Build with AI wrote is also marked AI. An unbound rule's card reads, for example, Applies to Invoice Number by default — bind it to a field in Field mapping to use it there. Saving the rule does not map the field. A rule you add is kept at once, and adding it clears the last test result. See Bind a rule to a field on this page.
Two messages mean the description did not build: AI did not produce any applicable operations from that description, and a longer one that starts AI output did not match the general-rule schema. The same description can also build on another try.
Figure 2. A plain-English rule after Build with AI
Example: an invoice number inside a note
A later Northwind Traders file has no Invoice Number column. Each invoice number sits in a Remarks note, such as Part payment of INV-10204. A rule described as Take the invoice number from the Remarks column. It starts with INV- and is followed by digits. builds regex_extract /(INV-\d+)/. Bound to Invoice Number and reading Remarks, it gives INV-10201 to INV-10205 for its five lines.
More plain-English descriptions that built a rule
The following table lists more descriptions that built on the Northwind Traders samples.
Table 1. Plain-English descriptions and what they built
| Description | WHAT IT WILL DO |
|---|---|
| Total Amount is the sum of Amount Paid on the lines where Status is PAID. | sum_where |
| When Status is SHORT PAY, set Denial Reason Client Comment to Short paid. | set = Short paid |
| If Payment Date is empty, use today's date. | default = TODAY |
Bind a rule to a field
A formula rule does nothing until a field uses it. A plain-English rule's card also asks you to bind it to a field.
- Open the field on Header fields or Line item fields.
- Choose Rule. The panel lists the rules that are on, each with its scope and what it does.
- Select the rule. The bar then names it, for example Rule · Sum of Amount Paid (document).
- If the rule rewrites a value, check the column under Value this rule transforms. The column the rule reads is already chosen, for example Remarks. To read another column, choose it from the list. The panel notes, for example, “Invoice number from Remarks” rewrites a value — choose the column it reads.
- Check the LIVE PREVIEW.
A formula rule's card on Rules then names the field it binds to, for example Binds to Total Amount. To use one rule for several fields, bind each field to it. The card then lists them all, for example Binds to Total Amount, Statement Number / Batch Number. Binding a field is a change on Field mapping, so it clears the last test result.
Figure 3. A field that reads a column through a plain-English rule
Predict rule with AI
Under the rule list, Predict rule with AI looks for the field's calculation in the sheet's totals. Bind the field to a rule yourself, because its answer can be wrong. On the Northwind Traders sample, it read Rule created & bound — For the whole document: the sum of Invoice Amount across all line items. The preview showed 7046.25, not the amount paid. The bar then read Rule · missing, and no new rule appeared on Rules. On the file with the Remarks notes, it answered No section-total rows found to learn a formula from on this sheet.
Change a rule
- On Rules, select the rule's edit icon. The rule opens in the form it was made with, and its details are filled in.
- Make your change. A plain-English rule shows its name, its description, and WHAT IT WILL DO. A formula rule shows its name, the formulas it came from, and the generalized rule. For a formula rule, Improve with AI can change what it calculates. Read the rule again before you save it.
- If you changed a plain-English rule's description, select Build with AI again. Check that WHAT IT WILL DO changed to match.
- Select Save rule. To leave the rule as it was, select Cancel.
The card changes in place, and no second rule is added. A field that uses the rule keeps using it, and its bar shows the new name. For a rule that a field uses, the change also clears the last test result. The change lasts only if you save the mapping. If the rule change is your only change, leaving gives no warning. The rule then goes back to how it was.
Save rule does not wait for a new build. A new description saved without Build with AI keeps the old steps. For example, the card can show If Remarks is empty, use NO-REF. above regex_extract /(INV-\d+)/. Built again, the steps of the Remarks example changed to regex_extract /(INV-\d{5})/ for a description that asks for five digits.
A formula rule's form also shows its review notes. For example, Auto-corrected: the first generalization didn't reproduce the file's own value; this one does. or Detected by AI — review before activating.
Switch a rule off or on
- On Rules, find the rule's card.
- Select its switch. The count on the Rules tab drops by one.
- To use the rule again, select the switch again.
A field that uses a switched-off rule shows Error and Rule is disabled. Activate then shows Resolve 1 field error before activating. When you switch the rule back on, the count goes back up and that reason goes away. A switched-off rule also leaves the Rule list of every field. Switching off a rule that a field uses clears the last test result. Switching a rule off lasts only if you save the mapping.
Delete a rule
- On Rules, find the rule's card.
- Select its delete icon. The rule is removed at once, with no confirmation.
A field that used the rule shows Error and Rule not found. Activate then shows Resolve 1 field error before activating. Bind the field to another rule, or choose another source. Deleting a rule clears the last test result. It lasts only if you save the mapping.