Syncing Fortnox Orders to HubSpot Orders
When Fortnox orders to HubSpot orders is enabled in App settings, the app can create or update HubSpot Order records from Fortnox orders discovered via the scheduled fetch job (optional env REPEATABLE_JOB_ORDERS_TO_HUBSPOT_PATTERN).
Orders that are makulerade in Fortnox (Cancelled) are still synced with hs_external_canceled_date set (which drives Is Canceled in HubSpot); the sync does not add deal, quote, or company associations for those orders.
If the Fortnox order Remarks contain HUBSPOT_DEAL_ID:<dealId> (this marker is added when a Fortnox offer is created from a HubSpot Quote, and may carry over when the offer becomes an order in Fortnox), the app also links the HubSpot Order to that Deal and adds the same Contact, Company, and Line item associations as the Deal (so the Order mirrors the Deal’s CRM relationships).
If Fortnox OfferReference is set (the offer’s document number when the order was created from an offert), the app finds the HubSpot Quote whose fortnox_offer_document_number matches; that quote is associated to the Order. If the deal was not already taken from Remarks, the app uses that quote’s single associated deal for the same contact/company/line item associations.
If no deal is resolved that way, the HubSpot Order is still created or updated from Fortnox (name, currency, total, external id). If the order has a CustomerNumber and a HubSpot Company exists with fortnox_id equal to that customer number (same linking as for invoices), the Order is associated to that company; otherwise it may stay unlinked from deals and companies.
Fortnox order pipeline (optional)
As with the Fortnox invoice deal pipeline, you can optionally enable a separate HubSpot Order pipeline named Fortnox order with stages Open, Processed, Shipped, Delivered, and Cancelled. On sync, the app sets hs_pipeline and hs_pipeline_stage from Fortnox: Cancelled → Cancelled; not Sent → Open; Sent and not NotCompleted → Delivered; Sent, NotCompleted, and WarehouseReady → Shipped; otherwise (still NotCompleted) → Processed. While the order pipeline is enabled in the app, each order sync can recreate the default pipeline in HubSpot if it is missing. If you turn off the order-pipeline feature in the app but old pipeline/stage IDs are still stored, the app does not auto-recreate until you re-enable the feature or clear that state. Do not delete the pipeline or its stages in HubSpot on purpose, or the stored configuration may no longer match.
Mappings:
| Field HubSpot (Order) | Direction | Field Fortnox | Notes |
|---|---|---|---|
| Order: hs_order_name | <- | DocumentNumber | Format: Fortnox order {DocumentNumber} |
| Order: hs_currency_code | <- | Currency | Defaults to SEK if missing |
| Order: hs_external_order_id | <- | DocumentNumber | Used to find or upsert the HubSpot order |
| Order: hs_total_price | <- | Total | Set when Total is present on the Fortnox order |
| Order: hs_external_canceled_date | <- | Cancelled | Yesterday’s date (UTC YYYY-MM-DD) when makulerad; cleared when not cancelled — HubSpot sets Is Canceled from this field |
| Association: Order ↔ Deal | <- | Remarks | When present: deal id parsed from HUBSPOT_DEAL_ID:<id> in Remarks (takes precedence) |
| Association: Order ↔ Quote | <- | OfferReference | Search Quote by fortnox_offer_document_number = OfferReference; associate Order ↔ that Quote when found |
| Association: Order ↔ Deal | <- | OfferReference | If no deal from Remarks: use that quote’s single quote_to_deal association |
| Associations: Order ↔ Contacts, Companies, Line items | <- | (via Deal) | Same records associated to the Deal are associated to the Order |
| Association: Order ↔ Company | <- | CustomerNumber | When no deal is linked: company search by fortnox_id = CustomerNumber |
| Order: fortnox_labels | <- | Labels[].Description | Multi-select; only values internal, external, warranty, order are stored |
| Order: fortnox_terms_of_payment | <- | TermsOfPayment | Betalningsvillkor (e.g. 30, 10, Z) |
| Order: fortnox_your_order_number | <- | YourOrderNumber | Customer purchase order number (PO Number) |
| Order: fortnox_invoice_email | <- | EmailInformation.EmailAddressTo | Invoice email |
| Order: fortnox_delivery_date | <- | DeliveryDate | Leveransdatum (YYYY-MM-DD) |
| Order: fortnox_way_of_delivery | <- | WayOfDelivery | Leveranssätt (Fortnox code, e.g. POST, BUDBIL) |
| Order: fortnox_terms_of_delivery | <- | TermsOfDelivery | Leveransvillkor (Fortnox code, e.g. FRITT, EXW) |
| Order: fortnox_your_reference | <- | YourReference | Er referens |
| Order: fortnox_billing_address_street / city / postal_code / country | <- | Address1 / City / ZipCode / Country | Faktureringsadress (custom HubSpot order properties; HubSpot has no native billing address on Order) |
| Order: hs_shipping_address_street / city / postal_code / country | <- | DeliveryAddress1 / DeliveryCity / DeliveryZipCode / DeliveryCountry | Leveransadress (HubSpot Order standard shipping address fields) |