Help Centre › Functions & Formulas
This article describes the RPA Xero connector function to create an invoice.
For a full list of available functions, please read XERO functions.
Description
The Create invoice function creates a new invoice in Xero. Specify the type (ACCREC for sales invoices, ACCPAY for purchase invoices/bills), the contact, and line items with descriptions, quantities, unit amounts, and account codes.
Setting it up
{{popups:rpas/add:action=xero-create-invoice}}
Once on a process map:
- Navigate to the process where you would like to add the function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the XERO Create invoice option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Connector | Yes | Select | - | Select the Xero connector to use |
| Type | Yes | Select | - | ACCREC (sales invoice) or ACCPAY (purchase invoice/bill) |
| Contact | Yes | Text | - | Contact as JSON: {"ContactID":"{contact_id}"} or {"Name":"Company Name"} |
| Line Items | Yes | Textarea | - | JSON array of line items, e.g. [{"Description":"Consulting","Quantity":1,"UnitAmount":1000,"AccountCode":"200"}] |
| Variable | Yes | Text | - | Variable to store the created invoice |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Object | The created invoice with InvoiceID, InvoiceNumber, Total, Status, etc. |
Errors
- Contact not found – the specified contact does not exist
- Invalid account code – the account code in a line item is invalid
- Validation error – required fields are missing
Tips
- Use ACCREC for invoices you send to customers, ACCPAY for bills from suppliers
- You can create contacts by Name if they don’t exist yet
- Access the invoice number via {variable.InvoiceNumber} after creation
- Line items support TaxType for tax calculations
Related functions
- List invoices – List all invoices
- Create payment – Pay against an invoice
- List contacts – Find contact IDs