Axelor icon

Axelor

Consume Axelor API

REST & Advances Service → Create a Record

AI-generated

Overview

The "REST & Advances Service" resource with the "Create a Record" operation in this n8n node allows you to create new records in any specified Axelor domain model via its REST API. This is achieved by sending a PUT request to the appropriate endpoint, with the record data provided as JSON.

Common scenarios:

  • Automating the creation of business objects (e.g., sales orders, customers) in Axelor from other systems.
  • Integrating form submissions or external triggers to generate new entries in your Axelor ERP/CRM.
  • Batch importing data into Axelor by mapping and pushing structured JSON content.

Practical example:
You could use this node to automatically create a new Sales Order in Axelor whenever a new order is received in your e-commerce platform.


Properties

Name Type Meaning
Domain Models Resource Locator Selects the target Axelor domain model (e.g., com.axelor.apps.sale.db.SaleOrder) where the record will be created. Can be entered as a string or selected from a list.
Content JSON JSON The full JSON body representing the record to create. For action services, you must include the model domain in this data field. Refer to Axelor documentation for required fields.

Output

  • The output is an array of JSON objects returned by the Axelor API after creating the record.
  • The structure of each object depends on the domain model and the data sent, but typically includes:
    • The newly created record's fields and values.
    • System-generated fields such as IDs, timestamps, etc.

Example output:

[
  {
    "id": 123,
    "name": "Sample Order",
    "status": "draft",
    // ...other fields as defined by the domain model
  }
]

Dependencies

  • External Service: Requires access to an Axelor instance with the REST API enabled.
  • Authentication: Needs valid Axelor API credentials configured in n8n (axelorApi).
  • Environment: The Axelor server URL and credentials must be set up in n8n credentials.

Troubleshooting

Common issues:

  • Invalid Domain Model: If the domain model is misspelled or does not exist, the API will return an error.
  • Malformed JSON: If the Content JSON property contains invalid JSON, the node will throw a parsing error.
  • Missing Required Fields: If required fields are omitted in the JSON body, Axelor will reject the request with a validation error.
  • Authentication Errors: Incorrect or missing credentials will result in authentication failures.

Error messages and resolutions:

  • "Unexpected token ... in JSON": Check that your Content JSON is valid and properly formatted.
  • "404 Not Found": Verify the domain model name and ensure the Axelor API endpoint is correct.
  • "401 Unauthorized": Ensure your Axelor API credentials are correctly configured in n8n.
  • "Validation failed": Review the required fields for the chosen domain model and provide all necessary data.

Links and References

Discussion