ExactOnlinePremium - ItemUpdate
The ItemUpdate method synchronizes item data from Exact Online to the App4Sales platform. This comprehensive synchronization process involves fetching item basic information, sales prices, stock levels, multi-language descriptions, classifications (item categories), and associated custom fields. The retrieved data is then mapped, transformed, and updated in the internal App4Sales database, ensuring items, their pricing, stock, and descriptive attributes are current. This process is designed to handle incremental updates based on timestamps for efficiency.
Data Source Configuration
The connector primarily pulls data from the Exact Online REST API. All API calls are authenticated using the configured Exact Online credentials. Data retrieval often utilizes skip tokens for pagination to handle large datasets.
VAT Codes: Retrieved from the Exact Online API endpoint for VAT codes (
VatCode.GetRoute).Price Lists: Fetched from the Exact Online API endpoint for price lists (
ExactOnlinePriceList.GetRoute). Price lists can be excluded based on connector settings.Exchange Rates: Retrieved from the Exact Online API (
ExchangeRate.GetRoute) if currency price list generation is enabled. Only the most recent exchange rates are considered, and inverse/self-rates are generated.Item Free Fields: Custom extra fields associated with items are fetched from the Exact Online API (
ExactOnlineItemExtraField.GetRoute).Warehouses: Specific warehouse information for package size determination is fetched from the Exact Online API (
ExactOnlineWarehouse.GetRoute) if configured.Item Sync Entities: Basic item information and metadata are retrieved from the Exact Online API (
ExactOnlineItem.GetRoute). Incremental updates are supported using theItemTimestampsetting.Assortments: Item assortments are retrieved from the Exact Online API (
ExactOnlineItemAssortment.GetRoute).Assortment Properties: Properties for active assortments are fetched from the Exact Online API (
ExactOnlineItemAssortmentProperty.GetRoutes).Item Group Entities: Descriptions for item groups are retrieved from the Exact Online API (
ExactOnlineItemGroup.GetRoutes).Sales Channels: Sales channel data is retrieved from the Exact Online API (
ExactOnlineSalesChannel.GetRoute) if theSalesChannelCodeToUseForOrderssetting is set. Requires a Professional or Premium Exact Online version.Default Sales Prices: Retrieved from the Exact Online API (
ExactOnlineSalesPrice.GetRoute). Expired prices are filtered out, and only active prices not linked to specific accounts are considered. Incremental updates are supported using theItemSalesPriceTimestampsetting.Purchase Order Lines: Used for determining next delivery dates, retrieved from the Exact Online Purchase Order API if
SyncNextDeliveryDateorGetDeliveryDatesOfflinesettings are enabled.Stock Information: Item stock levels are fetched from the Exact Online Stock API.
Assembly Materials: Information about assembled items' components is fetched from the Exact Online API (
ExactOnlineAssemblyBillOfMaterialMaterials.GetAssembledItemsRoutes).Assembly Orders: Details of assembly orders are fetched from the Exact Online API (
ExactOnlineAssemblyOrder.GetRoute).Custom Fields for Items: Additional custom fields for individual items are retrieved via a specific REST API route provided within the
ExactOnlineItemSyncentity (newItem.CustomField).
Data Mapping Table (App4Sales Item)
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Direct mapping, value is trimmed. |
|
| Mapped from the Exact Online unique identifier for the item, converted to string. |
|
| Direct mapping from the main sales price identified. |
|
| Calculated using the |
| (Output from VAT calculation) | Indicates whether VAT is included in the sales price. |
|
| Direct mapping from the main sales price currency. |
|
| If |
|
| Initially set from |
|
| Direct mapping. |
|
| Stores the Exact Online unit code (e.g., 'pcs', 'kg') for internal price lookups. |
|
| Direct mapping. |
|
| An "Assortiment" item class is created, taking its value from the description of the corresponding Exact Online Item Group. Additional item classes are generated from notes, extra descriptions, search codes, statistical codes, Exact Online item assortments (Class_01 to Class_10), KeyRename settings, and custom item extra fields. |
|
| Direct mapping. |
|
| Derived from an |
|
| Direct mapping. |
|
| Determined by connector settings: can be sourced from |
|
| Determined by connector settings: can be sourced from |
|
| Derived from the value of a custom extra field if |
|
| Direct mapping. |
| Exact Online Purchase Orders, Assembly Orders | Determined from the earliest future receipt date from relevant purchase order lines and assembly orders for the item, considering quantities. |
|
| A combination of free fields generated throughout the process (including delivery dates, staffle prices) is serialized into an XML string and stored here. |
Special Logic & Filters
Item Exclusion: Items can be excluded from synchronization based on
settings.PassWebShopItem(if not a webshop item),settings.IncludeNonSalesItems(if not a sales item),settings.CheckIfItemIsActive(if item is inactive), or a custom field specified bysettings.FieldUsedToIncludeItemsInSync.Pagination: REST API calls for fetching large lists of entities (e.g., items, sales prices, assortments) utilize skip tokens for efficient pagination.
Incremental Updates: The connector uses
ItemTimestampandItemSalesPriceTimestampsettings to retrieve only changes since the last synchronization, optimizing performance.Error Handling: Robust error handling is implemented for REST API calls, logging errors and preventing the entire synchronization from failing due to individual item issues.
Item Renaming/Deletion: If item codes change in Exact Online, the old items are removed from App4Sales based on a mapping of internal IDs.
Language Descriptions: Multi-language item descriptions are fetched and processed if configured, mapping up to five description fields in App4Sales.
Stock Calculation: Stock values are retrieved from Exact Online, and if the connector is
ExactOnlinePremium, these are adjusted to account for assembled items (Bill of Materials) usingAssemblyItemStockHelperand a formula executor.Delivery Date Calculation: Next delivery dates are calculated from future purchase order lines and, for the Premium connector, also from assembly orders. These can also be exposed as free fields.
Price List Synchronization: The synchronization includes complex logic for handling default sales prices, generating currency-specific price lists based on exchange rates, and processing volume discounts. It ensures that App4Sales price lists accurately reflect Exact Online pricing structures.
Price Consistency Check: A critical check is performed (
RemoveAllDbPricesWhenDifferent) to identify and remove any existing database prices for a given price list that do not match the newly synchronized prices from Exact Online. This prevents stale price data from persisting.
Domain Specifics (Expanded)
Price Logic
The connector supports a flexible pricing model, allowing for base sales prices, currency-specific price lists, and tiered/volume (staffle) pricing.
Base Sales Price: The primary sales price for an item is taken from Exact Online's default sales price.
Currency Price Lists: If
settings.GenerateCurrencyPriceListsis enabled, the connector automatically generates App4Sales price lists for various currencies. These are created by converting the default price using retrieved exchange rates. If Exact Online provides specific sales prices for a currency, those values override the exchange-rate-converted prices.Volume Discounts (Staffle Prices): Volume discounts are retrieved from Exact Online (
ExactOnlineSalesPriceListVolumeDiscountSync) and integrated into App4Sales price lists. These can also be explicitly exposed as item free fields if a specific price list code is configured insettings.PriceListCodeForStaffelFreeField, which reads pricing data from a CSV source.Price Overrides: The system prioritizes directly specified currency prices over exchange-rate-calculated prices.
Expiration: Expired sales prices in Exact Online are removed from App4Sales during synchronization.
Image Handling
The connector can download a single primary image per item from Exact Online.
Source: The
PictureUrlproperty of theExactOnlineItementity.Conditional Download: Image download is active only if both
settings.DisablePicturesFromEOLis false and the PIM settingAdministrationSession.CurrentSession.PimSettings.UseImagesOnlyFromPIMis false.Processing: Images are downloaded in a batch after all item metadata has been processed, using the Exact Online access token.
Storage: Downloaded images are added to the App4Sales item's
PicturesBytescollection, with a hash check to prevent storing duplicate images.
Stock & Availability
Stock synchronization is robust, especially for the Premium connector, which accounts for assembled items.
Sources: Stock data is retrieved from Exact Online's Stock API.
Multi-Warehouse Support: Stock can be filtered by a specific warehouse defined in
settings.WarehouseForStock.Assembled Items: For
ExactOnlinePremium, stock calculations consider Bill of Materials (BOM). The connector fetches details of assembled items and their components, then adjusts stock values using theAssemblyItemStockHelper. This ensures accurate stock figures for products built from multiple parts.Stock Indicator: An item's stock indicator can be calculated based on a configurable formula (
Session.ConnectorBaseSettings.GetStockIndicatorByFormula) or derived from the available stock and other relevant quantities (shelf stock, to be delivered, to be received).Next Delivery Dates: Calculated from future purchase order lines. For the Premium connector, future assembly orders are also considered to determine the earliest possible next delivery date. These dates can be stored as App4Sales item free fields if
settings.GetDeliveryDatesOfflineis enabled."In Stock" Item Class: An item class "In stock" is generated, with a value of "Yes" if
LastAvailableStockis greater than 0, and "No" otherwise.
Matrix & Attributes
Item categorization and custom attributes are extensively supported.
Item Classes:
An "Assortiment" item class is created from the Exact Online Item Group description.
Default item classes for "Notes", "Extra Description", "Search code", and "Statistical Code" are created.
Item assortments (
Class_01toClass_10) from Exact Online are mapped to corresponding item classes in App4Sales, using their descriptions or codes based onsettings.UseItemAssortmentDescriptions.Custom item extra fields from Exact Online are converted into App4Sales item classes.
Dynamic item classes can be created based on
KeyRenamesettings, allowing for flexible mapping of Exact Online properties to App4Sales item classes.If
settings.UseSalesPriceInclVatAsFreeFieldis enabled, a "ConsumerPrice" item class (with VAT included) is added.
Custom Fields: The ExactOnlinePremium connector specifically fetches and maps custom fields configured in Exact Online to new item categories in App4Sales, using the custom field's property name and caption.
Related Settings & Prerequisites
Applicationkey: Essential for authenticating with the Exact Online API.CurrentDivision: The Exact Online division from which to synchronize data.ItemTimestamp: Used for incremental item updates; stores the timestamp of the last successful item synchronization.ItemSalesPriceTimestamp: Used for incremental sales price updates; stores the timestamp of the last successful sales price synchronization.WarehouseForStock: (Optional) Specifies a particular warehouse code to filter stock information.GenerateCurrencyPriceLists: (Boolean) If true, the connector generates App4Sales price lists for each currency based on exchange rates.ExcludePriceList: (String, semicolon-separated) A list of Exact Online price list codes to exclude from synchronization.PriceListCodeForStaffelFreeField: (String) If set, enables reading staffle (tiered) prices from a CSV source associated with this price list code and mapping them as item free fields.ExtraDescriptionOnDescription: (Boolean) If true, uses the Exact Online item'sExtraDescriptionas the primary App4SalesDescriptionif available.GetPurchasePackageSizeFromSearchCode: (Boolean) If true, attempts to parse the item'sSearchCodefor the purchase package size.GetPurchasePackageSizeOnExtraItemDescription: (Boolean) If true, attempts to parse the item'sExtraDescriptionfor the purchase package size.SplitCharacterForExtraItemDescription: (String) Used withGetPurchasePackageSizeOnExtraItemDescriptionto split the extra description.PurchasePackeSizeIndex: (Integer) Used withGetPurchasePackageSizeOnExtraItemDescriptionto specify which part of the split extra description to use.GetPurchasePackageSizeFromFreeField: (String) If set, attempts to retrieve the purchase package size from a custom extra field matching this description.SearchCodeForEanCode: (Boolean) If true, uses the item'sSearchCodeas the EAN code.UseItemExtraDescriptionForItemField: (String) If set to "eancode", uses the item'sExtraDescriptionas the EAN code.UseItemNotesForItemField: (String) If set to "eancode", uses the item'sNotesas the EAN code.FreeSortField: (String) Specifies an Exact Online item property to use for the App4SalesFreeSortField.PassWebShopItem: (Boolean) If true, only items marked as webshop items in Exact Online will be synchronized.IncludeNonSalesItems: (Boolean) If true, non-sales items from Exact Online will be synchronized.CheckIfItemIsActive: (Boolean) If true, only active items in Exact Online will be synchronized.FieldUsedToIncludeItemsInSync: (String) Specifies a custom field whose boolean value determines if an item should be included in the sync.UseSalesPriceInclVatAsFreeField: (Boolean) If true, creates an "ConsumerPrice" item class with the sales price including VAT.UseItemAssortmentDescriptions: (Boolean) If true, uses descriptions for item assortment properties; otherwise, uses their codes.DisablePicturesFromEOL: (Boolean) If true, prevents downloading pictures from Exact Online.SyncNextDeliveryDate: (Boolean) If true, calculates and synchronizes the earliest next delivery date for items.GetDeliveryDatesOffline: (Boolean) If true, stores detailed future delivery dates as item free fields.EnableOfflineTierPrices: (Boolean) If true, enables the synchronization of offline tier prices.
Known Limitations
The image handling currently only processes a single primary image per item (
PictureUrl).The
UnitFactorAsPurchasePackageSizesetting is present in code but marked as a "TODO" and explicitly noted as not implemented, suggesting this functionality is not available.Multi-language descriptions are mapped to generic
Description,Description2, etc., fields. The specific language is indicated by a suffix in the item class name (e.g., "ExtraDescription EN").