Sage One Accounting¶
Overview¶
The Sage One Accounting task integrates BaseCloud CRM with Sage One (Sage Business Cloud Accounting), enabling automated creation and retrieval of quotes, tax invoices, and customer records in your Sage accounting system.
Key Features:
- 6 Actions: Create quotes/invoices, manage customers, fetch documents
- Basic Authentication: Username/password + company ID
- Document Number Management: Manual control with automatic sequence reset
- Item-Based Line Items: Links to Sage inventory items
- Tax Type Support: Configurable tax rates per line item
- South African Focus: Optimized for ZAR and SA tax regulations
Use Cases:
- Sync CRM deals to Sage quotes and invoices
- Automated customer creation from CRM contacts
- Invoice generation on service completion
- Quote workflows with Sage document management
- Item-based billing with Sage inventory tracking
Prerequisites¶
1. Sage One Account¶
- Active Sage One subscription (South Africa)
- Account with API access enabled
- Username and password for authentication
- Company ID (available in Sage account settings)
2. Sage API access¶
BaseCloud calls Sage with its own Sage API key, so there is nothing to register. The task signs in with the Username, Password and Company ID set on it.
3. Sage Inventory Setup¶
For Invoice/Quote Creation:
- Items must exist in Sage inventory with item codes
- Note exact item codes for use in line items
- Configure tax types in Sage (note numeric IDs)
4. Customer Records¶
For Invoice Creation:
- Customers must exist in Sage with customer IDs
- Use
find_customerorcreate_customeractions first - Note customer IDs for quote/invoice creation
Tax: whether the unit prices you send include tax is the task's own Tax Inclusive setting, sent to Sage with the document. (The account's own "Invoice prices are" setting in Settings › General applies to BaseCloud's quotes and invoices, not to Sage.)
Outputs¶
Which fields appear depends on the action. Customer and invoice lookups populate their own groups.
Reference fields as {{task_<ID>_<field>}}.
| Field | Type | Notes |
|---|---|---|
output |
string | The Sage response body for the main call. Present only on some actions. |
response |
string | The Sage response body for an invoice call. Present only on some actions. |
customer_matched |
boolean | true when an existing customer was found. Present only on some actions. |
customer_matched_id |
string | The matched customer's Sage ID. Present only on some actions. |
customer_matched_name |
string | The matched customer's name. Present only on some actions. |
customer_matched_email |
string | The matched customer's email. Present only on some actions. |
invoice_matched |
boolean | true when an existing invoice was found. Present only on some actions. |
invoice |
string | The matched invoice record. Present only on some actions. |
Always emitted¶
| Field | Type | Notes |
|---|---|---|
run |
boolean | Whether the task succeeded. |
run_text |
string | What happened, including the reason on failure. |
Fields marked as action-dependent may be absent
This task does several different things depending on its action setting, and only the fields relevant to that action are emitted. Check a real run in the OUTPUT panel before referencing one downstream.
Configuration¶
Builder fields¶
The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.
| Field | Key | Type | Default | Notes |
|---|---|---|---|---|
| Action | sage_action |
select | create_quote |
Options: Create Customer · Find Customer · Create Quote · Create Tax Invoice · Fetch Quote · Fetch Tax Invoice |
| Username | Username |
text | – | |
| Password | Password |
text | – | |
| Company ID | companyid |
text | – | |
| Customer Name | Customer Name |
text | – | Only shown when sage_action is create_customer |
| Customer Email | Customer Email |
text | – | Only shown when sage_action is create_customer |
| Customer Name | Customer Name |
text | – | Only shown when sage_action is find_customer |
| Customer ID | Customer Id |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Document Number | Document Number |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Customer Reference | Customer Reference |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Expiry Date | Expiry Date |
text | – | Only shown when sage_action is create_quote |
| Due Date | Due Date |
text | – | Only shown when sage_action is create_tax_invoice |
| Tax Inclusive | Tax Inclusive |
select | false |
Options: No · Yes. Only shown when sage_action is create_quote, create_tax_invoice |
| Item Code(s) | Item Code |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Tax Type ID(s) | Item TaxTypeId |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Item Description(s) | Item Description |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Item Comments (optional) | Item Comments |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Item Quantity(ies) | Item Quantity |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Unit Price(s) | Item Unit Price |
text | – | Only shown when sage_action is create_quote, create_tax_invoice |
| Quote ID | Quote ID |
text | – | Only shown when sage_action is fetch_quote |
| Invoice ID | Invoice ID |
text | – | Only shown when sage_action is fetch_tax_invoice |
Actions¶
Every action needs Username, Password and Company ID — the task fails at once without any of them, and without an action.
Create Quote and Create Tax Invoice¶
Both build the same document from the same settings; a quote takes an Expiry Date, a tax invoice a Due Date
(both DD/MM/YYYY HH:mm). The document is dated today. An empty or past expiry or due date becomes today.
- Customer ID — the Sage customer's ID (Find Customer gives it).
- Document Number and Customer Reference — written onto the document as given.
- Tax Inclusive — Yes when the unit prices include tax.
- Line items, as lists separated by
|, one entry per line: Item Code(s) (each must exist in Sage's items), Tax Type ID(s), Item Description(s), Item Quantity(ies), Unit Price(s), and optionally Item Comments. Every list must have the same number of entries, or the task fails with "Sage line items length mismatch." A Comments list of a different length is ignored — every line's comment is left empty. To carry the details shown under an item in BaseCloud, mapitem_detailsinto Item Comments: it always has one entry per line.
The task reads Sage's current document numbering first and puts it back afterwards, so writing your own Document
Number does not move Sage's own sequence on. Sage's created document is in response.
Failures name their cause: "Failed to get current document number." (Sage refused the credentials or the company), "Failed to get Item Code …" (no such item in Sage), "Sage line items length mismatch.", and "Failed to create quote." / "Failed to create invoice." (Sage rejected the document).
Create Customer¶
Creates a Sage customer from Customer Name and Customer Email. Sage's created customer is in response. It
does not check for an existing customer first — use Find Customer for that.
Find Customer¶
Looks for a customer whose name is exactly Customer Name. Found: customer_matched is true, with
customer_matched_id, customer_matched_name and customer_matched_email. Not found is not a failure: the task
completes with "No customer found." and customer_matched false.
Fetch Quote and Fetch Tax Invoice¶
Find one quote (Quote ID) or tax invoice (Invoice ID) — matched against the document's document number in
Sage, so give the number shown on the document. Found: invoice_matched is true and invoice holds the document.
Not found is not a failure: the task completes saying so, with invoice_matched false.
Real-World Examples¶
Raise an invoice when a deal is won¶
CRM Trigger (status changed to "Won")
└─ Match to Client look the client up
└─ Sage create a tax invoice for {{task_15001_match_client_name}}
Store the Sage customer ID on the client as a custom field so this step can map it straight in.
Create the Sage customer the first time you invoice them¶
CRM Trigger
└─ Sage find the customer by name
└─ If Statement {{task_21001_customer_matched}} is false
└─ Sage create the customer
customer_matched, customer_matched_id and customer_matched_name tell you whether the
customer already exists, so you only create when you need to.
Email the invoice once Sage has it¶
Troubleshooting¶
Error: "Failed to get current document number"¶
Cause: Cannot retrieve document number sequence from Sage API
Solutions:
-
Verify credentials (Username, Password, Company ID) are correct
-
Check Sage API access is enabled for account
-
Sign in to Sage One with the same username and password to check them
-
Contact Sage support if API access issues persist
Error: "Failed to get Item Code {code}"¶
Cause: Item code doesn't exist in Sage inventory
Solutions:
-
Verify item code exists: Log into Sage → Inventory → Items → Search for code
-
Check exact spelling, and that no spaces crept in around the
|separators -
Create missing items in Sage first
Error: "Sage line items length mismatch"¶
Cause: Pipe-delimited arrays have different numbers of items
Solutions:
- Count pipes in each field - must be equal:
Item Code: "A|B|C" // 3 items
Item Quantity: "1|2|3" // 3 items
Item Unit Price: "10|20" // 2 items ✗ MISMATCH
-
Exception: Item Comments may differ in length — then every line's comment is left empty
-
Build every line-item list from the same source so the lists stay the same length
Error: "Failed to create quote/invoice"¶
Cause: Sage API rejected document creation
Solutions:
-
The run's message (
run_text) carries the failure -
Common issues:
- Customer ID doesn't exist (use find_customer first)
- Tax Type ID invalid (check Sage tax type configuration)
- Document number already exists (use unique numbers)
- Date format incorrect (must be DD/MM/YYYY HH:mm)
- Negative quantities or prices
-
Validate all required fields are populated
-
Test with minimal invoice (1 line item) first
-
Ensure Tax Inclusive matches price format (inclusive vs exclusive)
Customer Not Found with find_customer¶
Cause: Exact name match not found in Sage
Solutions:
-
Check for typos or extra spaces in customer name
-
Sage search is exact match - "Acme Corp" ≠ "Acme Corporation"
-
Use standardized naming in CRM to match Sage
-
Create the customer when none is found: an If on
{{task_21001_customer_matched}}equalsfalse→ Create Customer
Document Number Sequence Issues¶
Cause: Manual document number conflicts with Sage auto-increment
Solutions:
- Use unique prefixes for CRM-generated documents:
- CRM quotes:
CRM-QU-001 - CRM invoices:
CRM-INV-001 -
Sage internal:
QU001,INV001 -
The task puts Sage's own numbering back after writing your number, so Sage's sequence is not moved on by it
Authentication Failures¶
Cause: Invalid Basic Auth credentials
Solutions:
-
Verify Username and Password are correct (test in Sage web UI)
-
Check Company ID is numeric and correct
-
Check the Sage account has API access enabled
Tax Type ID Confusion¶
Cause: Incorrect or unknown tax type IDs
Solutions:
-
Tax Type IDs are numeric (e.g., 1, 2, 3) and company-specific
-
Find your company's tax type IDs in Sage, or ask Sage support for the IDs its API uses
Best Practices¶
- Use a dedicated Sage user for the task's Username and Password, with only the access it needs.
- Find before you create: run Find Customer first and create the customer only when
customer_matchedis false — Create Customer does not check for duplicates. - Keep item codes identical in your quotes and in Sage's items; a code Sage does not have fails the task.
- Build every line-item list from the same source so they stay the same length.
- Fill Customer Reference with something that ties the document back to the CRM, such as the client's name or a deal number.
- Use a Delay between Sage tasks in a loop to stay clear of Sage's rate limits; a rate-limited call is retried later on its own.
FAQ¶
Q: Can I edit or delete Sage quotes and invoices from BaseCloud?
A: No — the task creates and fetches them. Edit or void them in Sage.
Q: Where do I find Tax Type IDs?
A: They belong to your Sage company. Find them in Sage, or ask Sage support for the IDs its API uses.
Q: How do I check an invoice later?
A: Fetch Tax Invoice with its document number; invoice holds what Sage has for it.
Q: Why did a run fail?
A: The run's message (run_text) says which step failed — see Troubleshooting above for each message.
Related Tasks¶
- BaseCloud Accounting - Internal alternative to Sage
- Xero - Alternative accounting integration
- Email - Send invoice notifications
- Loop - Bulk invoice creation
- If Statement - Handle customer creation logic
- Workflow Note - Log Sage actions
- Timer Trigger - Schedule recurring billing
- CRM Trigger - Trigger on deal/client changes
Technical Details¶
- Type ID: 21
- Function:
taskSage()in automationService.js - API: Sage One Accounting API v2.0.0
- Authentication: HTTP Basic Auth (Username:Password)
- Base URL:
https://accounting.sageone.co.za/api/2.0.0/ - Outputs:
{{task_<ID>_<field>}}, the ID being the task's own - Geographic Focus: South Africa (ZAR, VAT compliance)