HubfiscalLogSageBatch
Description
Section titled “Description”Place it after the SageX3Soap node (save operation). It stores Sage’s response and the grouped invoice number (VCRNUM) in the batch, and copies that number to every document in the batch. This way, from an order you can see which Sage invoice it belongs to and, from a Sage invoice, which orders make it up.
It is part of the daily Hub Fiscal → Sage X3 posting process, together with HubfiscalAggregateSales.
Key features:
- Traceability both ways: stores
sage_vcrnumand the posting date in the batch and in each document. - Idempotent: if the batch is already recorded, it does not overwrite the stored number.
- Failure handling: if Sage returned an error, the batch is left as
failedwith the reason, including Sage’s business message. - Warning if the number is missing: if Sage answers OK but without
VCRNUM, the batch is leftsentwith a warning so you can complete it by hand.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Hub Fiscal MySQL/MariaDB credential (sqlQuery type) |
| batch_id | text | No | Batch id. Default {{item.batch_id}}; inside an Iterator over batches you can use {{batch_id}} |
The data from the previous step, which must include:
- The batch identifier (
batch_id), coming from HubfiscalAggregateSales. - Sage’s response (
sage_response), added by the SageX3Soap node.
The invoice number is looked up at any level of the response, whether Sage returns JSON or XML.
Output
Section titled “Output”{ "logged": true, "batch_id": 102, "batch_status": "sent", "sage_vcrnum": "FTC0000123", "message": "Lote 102 enviado a Sage (FTC0000123)"}| Field | Description |
|---|---|
logged | true if it was written; false if the batch was already recorded or it was a simulation |
batch_status | sent or failed |
sage_vcrnum | Number of the grouped invoice in Sage |
warning | Only if Sage answered OK without an invoice number |
The message text is in Spanish, as it appears in the product.
What is stored
Section titled “What is stored”In the batch: status, Sage’s response, grouped invoice number, error reason if it failed and sent date. In each document of the batch: Sage’s invoice number and the date it was posted.
Traceability query (example):
-- Which Sage invoice is order 17513 in?SELECT order_number, fiscal_doc_number, sage_vcrnum, sage_posted_at FROM documents WHERE order_number = '17513';- It records nothing in simulation: if the entry is flagged as simulated, the node ends without writing.
- When the SageX3Soap node fails, the flow for that entry is cut and this node never runs: the batch stays pending and is resent on the next run of the same day.
- A batch that does not exist returns a clear error (
Lote N no encontrado).
Related Nodes
Section titled “Related Nodes”- HubfiscalAggregateSales - Groups the day’s sales and creates the batches
- SageX3Soap - Sends the entry to Sage X3
- HubfiscalGetDocuments - Query documents in Hub Fiscal