Auto-coding rules for Purchase Orders
This article applies to users who can manage accounting rules. You must have the Procurement product enabled and an accounting provider connected. If you cannot manage accounting rules, ask an Admin or Owner to update your role. See Customizing roles and permissions.
Overview
Ramp's accounting rules can automatically populate accounting fields on Purchase Orders, reducing manual coding work for your AP team. Previously available only for card transactions and expenses, auto-coding rules now support Purchase Orders as an expense type.
Auto-coding rules run when:
- A Purchase Order request is ready for approval
- You save a new rule (Ramp executes it against all eligible existing Purchase Orders)
Purchase Order auto-coding uses the same accounting rules system as transactions and expenses. For a full overview of rule types and the accounting rules hierarchy, see Managing Accounting Rules.
Access auto-coding rules
You can access auto-coding rules from the Purchase Order settings or directly from the accounting rules page.
From purchase order settings
- Go to Procurement > Purchase Orders > Settings .
- Select the Automation tab.
- Under Autocoding , click Coding rules . This opens the accounting rules drawer.
From accounting settings
- Go to Settings > Accounting .
- Open Coding Rules . Rules created here with the Expense type is Purchase Order condition apply to POs.
Create an advanced rule for purchase orders
Advanced rules use if/then logic to code Purchase Orders based on conditions you define. Use an advanced rule when you want to target Purchase Orders specifically.
- In the accounting rules drawer, select Advanced rules and click Create rule .
- In the If the following conditions are met step, add the condition: Expense type is Purchase Order . You can add additional conditions such as category, merchant, department, or location.
- In the Then code to the following fields step, choose an action type:
- Set fields directly — map specific accounting field values (such as GL Account, Department, Class, or Location).
- Use a Custom Field — pull values from a custom field.
- Use a Matrix — apply a custom matrix for multi-dimensional coding.
- Name the rule and click Save .
On save, Ramp executes the rule against all eligible Purchase Orders and applies it automatically when a Purchase Order request is ready for approval.
Simple rules
Simple (mapping) rules create a direct link between a Ramp field and an accounting field. For example, you can map a Ramp Category to a specific GL Account. Simple rules apply across all expense types, including Purchase Orders, when the mapped field values match.
- In the accounting rules drawer, select Simple rules and click Create rule .
- Select the Ramp field to match on (such as Category, Merchant, Department, or Location).
- Select the accounting field to set (such as GL Account, Department, or Class).
- Map the values and click Save .
Note: Simple rules are not limited to Purchase Orders. They apply to any matching expense type. For PO-specific rules, use an advanced rule with the Expense type is Purchase Order condition.
How auto-coding appears on purchase orders
When an accounting field on a Purchase Order has been set by a rule, Ramp displays a lightning bolt icon next to the field. The tooltip identifies the rule by name. Default values show Set by default value.
Click Edit rule from the field to open the rule that applied the value.
If you manually set an accounting field value on a Purchase Order, auto-coding rules do not overwrite it. Manual selections are always preserved.
Permissions
- Edit Purchase Order Settings — required to access the Automation tab in Purchase Order settings. See Procurement Role Configuration .
- Manage accounting rules — required to create and edit accounting rules.
Frequently asked questions
Do auto-coding rules apply to existing Purchase Orders?
When you save a new advanced rule with the condition Expense type is Purchase Order, Ramp executes it against all eligible existing Purchase Orders. Rules also run automatically when a Purchase Order request is ready for approval.
Can I use simple rules for Purchase Orders?
Yes. Simple (mapping) rules apply across all expense types, including Purchase Orders, when the mapped Ramp field values match. For targeted PO-only rules, use an advanced rule with the Expense type is Purchase Order condition.
Which accounting fields can be auto-coded?
The available accounting fields depend on your connected accounting provider. Common fields include GL Account, Department, Class, Location, and Inventory Item.
Do auto-coding rules overwrite values I set manually?
No. If you manually set an accounting field value on a Purchase Order, auto-coding rules preserve your selection and do not overwrite it.
Are all Purchase Orders eligible for auto-coding?
Auto-coding applies to Purchase Orders created in Ramp or through the Developer API. Draft POs and POs imported from your ERP are excluded from auto-coding.
Can I see which rule coded a Purchase Order?
Yes. Fields coded by a rule display a lightning bolt icon with a tooltip that identifies the rule by name. Click Edit rule to open the rule directly.