Actions16
- Meta Service Actions
- REST & Advances Service Actions
- Document Service Actions
Document Service → Add Attachment
AI-generatedOverview
The Add Attachment operation in the Document Service resource of this n8n node allows you to add (update) an attachment to a specific domain model entity within the Axelor platform. This is typically used when you need to programmatically associate files or documents with business objects such as sales orders, invoices, or other records managed by Axelor.
Common scenarios:
- Attaching scanned contracts or signed documents to customer records.
- Adding supporting documentation to sales orders or purchase orders.
- Automating document management workflows where files must be linked to specific entities.
Practical example:
You have a sales order in Axelor and want to attach a PDF invoice to it automatically after generating the invoice in your workflow.
Properties
| Name | Type | Meaning |
|---|---|---|
| Domain Models | Resource Locator | Specifies the domain model (e.g., com.axelor.apps.sale.db.SaleOrder) to which the attachment will be added. You can select from a list or enter the domain string directly. |
| Content JSON | JSON | The body of the request containing all necessary details for the attachment. This should include information about the file and its metadata as required by Axelor's API. |
Output
The output is a JSON array containing the response from the Axelor API after attempting to add the attachment. The structure of each item in the array depends on the Axelor API's response, but typically includes:
- Status of the operation (success/failure)
- Details of the attached file (such as ID, name, etc.)
- Any error messages if the operation failed
Example output:
[
{
"status": 0,
"data": [
{
"id": 123,
"fileName": "invoice.pdf",
"createdOn": "2024-06-01T12:34:56Z"
}
]
}
]
Note: The actual fields depend on Axelor's API.
Dependencies
- External Service: Requires access to an Axelor instance with the DMS (Document Management System) module enabled.
- API Credentials: You must configure valid Axelor API credentials (
axelorApi) in n8n. - Environment: The node must be able to reach the Axelor server endpoint.
Troubleshooting
Common issues:
- Invalid Domain Model: If the domain model string is incorrect, the API may return a "not found" or "invalid domain" error.
- Malformed Content JSON: If the JSON body is not properly structured or missing required fields, the API will reject the request.
- Authentication Errors: Invalid or missing API credentials will result in authentication failures.
- File Size Limits: Attempting to upload attachments that exceed server limits may cause errors.
Error messages and resolutions:
"400 Bad Request": Check that your Content JSON is correctly formatted and contains all required fields."401 Unauthorized": Ensure your Axelor API credentials are set up correctly in n8n."404 Not Found": Verify the domain model and entity ID exist in your Axelor instance."413 Payload Too Large": Reduce the size of the file being attached.