Fortnox - Create Customer
This document describes the process of creating a new customer in Fortnox via App4Sales. The functionality is triggered when a new customer is created in the App4Sales application. The connector either creates a new customer or updates an existing one based on the presence of a customer number.
Trigger & Permissions
The customer creation process is initiated from the App4Sales application. The connector must be configured to allow customer creation. This is controlled by the CreateCustomer and EditCustomer connector information flags. The request is sent as an XML payload.
Payload Mapping
The incoming customer data from App4Sales is mapped to the Fortnox customer model. The following tables detail the field mappings.
Customer Header
Fortnox Field | App4Sales Field | Logic/Notes |
Active | N/A | Hardcoded to |
CustomerNumber | CustomerCode | If this field is empty or null, a new customer will be created. Otherwise, the existing customer with this number will be updated. |
Name | CustomerName | |
VATNumber | VatCode | |
PriceList | UsesPrice | The |
TermsOfPayment | PaymentCondition | |
Phone1 | Phone | |
Phone2 | Mobile | |
OrganisationNumber | ChamberOfCommerceCode | |
Type | N/A | Hardcoded to |
VATType | CountryCode, VatCode | Determined based on the customer's country and VAT number. See the "Validation & Defaults" section for more details. |
Currency | UsesPrice | The currency is derived from the price list associated with the customer. |
YourReference | ContactFullName | |
OurReference | (from SalesRep) | If the |
Comments | (from SalesRep) | If the |
Addresses
Fortnox supports three types of addresses: Invoice, Visiting, and Delivery. The mappings for these are as follows:
Fortnox Address Field | App4Sales Field | Address Type |
City | VisitCity | Invoice |
Address1 | VisitAddress1 | Invoice |
CountryCode | CountryCode | Invoice |
ZipCode | VisitPostCode | Invoice |
VisitingCity | VisitCity | Visiting |
VisitingAddress | VisitAddress1 | Visiting |
VisitingCountryCode | CountryCode | Visiting |
VisitingZipCode | VisitPostCode | Visiting |
DeliveryCity | DeliveryCity | Delivery |
DeliveryAddress1 | DeliveryAddress1 | Delivery |
DeliveryAddress2 | DeliveryAddress2 | Delivery |
DeliveryCountryCode | CountryCode | Delivery |
DeliveryZipCode | DeliveryPostCode | Delivery |
Validation & Defaults
VAT Type Determination
The VATType is determined by the following rules:
If the
CountryCodeis empty, theVATTypeis set toEXPORT.If the
CountryCodeis "SE" (Sweden), theVATTypeis set toSEVAT.If the
CountryCodeis another European country:If a
VatCode(VAT number) is provided, theVATTypeis set toEUREVERSEDVAT.If no
VatCodeis provided, theVATTypeis set toEUVAT.
For all other countries, the
VATTypeis set toEXPORT.
Response & Error Handling
After attempting to create or update a customer, the connector checks for errors from the Fortnox API.
If an error occurs, the process is stopped and an error message is returned (e.g., "ERROR: [Error message from Fortnox]").
If the operation is successful, a success message with the customer number is returned (e.g., "Succes: [Customer Number]").
Related Settings & Prerequisites
SetSalesRepNameAsOurReference: When enabled, the sales representative's name is placed in the 'OurReference' field for new customers.
UseCommentsForCustomerManager: When enabled, the sales representative's name is placed in the 'Comments' field for new customers.