NewBase Connector - ItemUpdate
The ItemUpdate function synchronizes product information, including prices, stock, and various attributes, from the NewBase ERP system to the App4Sales platform. This process runs whenever a full item synchronization is triggered within App4Sales. The connector supports both API Version 2 (V2) and API Version 4 (V4) of the NewBase API, with slight variations in data retrieval and processing logic.
Data Source Configuration
The App4Sales connector pulls data from the NewBase ERP system via its REST API. Authentication details (API keys, base URLs) are configured within the connector settings. The specific API version used (V2 or V4) is determined by the 'ApiVersion' setting in the connector configuration.
Endpoints: Various NewBase API endpoints are called to retrieve product details, product groups, product properties, prices, currency rates, and stock information.
Data Format: JSON responses from the NewBase API.
Data Mapping Tables
App4Sales Item Mapping
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Direct mapping. Used to identify the product in App4Sales. |
|
| Direct mapping. Unique internal identifier for the product in NewBase. |
|
| Direct mapping. |
|
| For V2: Direct mapping from |
|
| Direct mapping. |
|
| For V2: Direct mapping from |
| Hardcoded | Always set to 'E' (Exclusive). |
|
| The |
|
| If 'Use product remark as free sort field' setting is enabled, |
|
| For V2: Retrieved via the |
|
| For V2: |
|
| If 'Do not sync item pictures' setting is disabled, an image is downloaded from the URL provided by |
App4Sales PriceList Mapping
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Generated identifier based on the NewBase PriceList ID and currency code. |
|
| Generated code based on the NewBase PriceList Code and currency code. |
|
| Formatted as "{NewBasePriceList Name} - {Currency}". |
|
| The currency for which this PriceList is valid. |
| Hardcoded | Always set to |
|
| The original identifier from NewBase for external referencing. |
App4Sales PriceListPrice Mapping
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Direct mapping. |
|
| Direct mapping of the calculated sales price. |
|
| Generated identifier based on the PriceList ID and currency code, ensuring the price is linked to the correct App4Sales PriceList. |
App4Sales ItemClass and ItemClassValue Mapping
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
| Hardcoded | Always set to |
|
| Uses the value from the 'Product group name' setting. Defaults to "Productgroep" if the setting is empty. |
|
| References the ID of the parent ItemClass ( |
|
| Direct mapping of the product's item code. |
|
| For V2: Retrieved from the |
App4Sales ItemCategory Mapping
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
| "Extra description" | Category for |
|
| The value of the product's extra description. |
| "Remark" | Category for |
|
| The value of the product's remark. |
| "Remark composition" | Category for |
|
| The value of the product's remark composition. |
|
| For each |
|
| The value of the product property. |
| "Extra description {LanguageProductDescr}" (V4 only) | For V4, if |
|
| The value of the extra description for a specific language. |
Special Logic & Filters
Product Validation: Items are only processed if they are valid according to the
IsProductValidlogic. A product is valid if it is not marked as 'Blocked' in NewBase and if its 'TimeStart' and 'TimeEnd' (if set) indicate that the current date falls within the active period.Product Filtering:
Products marked as 'Blocked' in NewBase are skipped.
If 'Skip discontinued products' is enabled, products with
Discontinued = trueare skipped.If 'Skip products without sales price' is enabled, products with
SalesPrice = nullare skipped.If 'Skip products with name prefix' is configured, products whose name starts with any of the specified prefixes are skipped.
V4 Specific: If 'Sync only products with subscription types' is configured, only products with matching subscription types are synced.
V4 Specific: If 'Sync only service products' is enabled, only products where
IsServiceProduct = 1are synced.Products with empty
ItemCodeafter conversion are skipped.
Stock Retrieval:
The stock retrieval process can adjust the item code sent to NewBase using 'Item prefix to remove for stock' and 'Item prefix to use for stock' settings.
It targets a specific warehouse based on 'Warehouse ID for stock' or defaults to warehouse '1'.
A fallback mechanism is in place: if an item with a prefixed item code yields no stock, a second attempt is made with the original item code.
Multi-language Descriptions: The connector attempts to map descriptions to different language fields (
Description,Description2, etc.) in App4Sales based on the language information provided by NewBase or the default language setting. A maximum of 5 distinct language descriptions are supported.
Domain Specifics (Expanded)
Price Logic
The connector retrieves comprehensive pricing information from NewBase, including base prices, price breaks, and debtor-specific rebates.
Base Price:
NewBaseProduct.SalesPriceprovides the fundamental sales price.Price Breaks and Rebates:
NewBaseProductPriceBreakandNewBaseDebtorRebateentities are fetched. These can define:Specific prices for individual products.
Discounts for individual products (percentage off the base sales price).
Prices for product rebate groups.
Discounts for product rebate groups.
Discount Application: Discounts defined in NewBase are applied to the base sales price during the synchronization process if the 'Apply discounts during sync item prices call' setting is enabled.
Price Selection (V4): For NewBase API V4, if multiple price breaks apply to a single product, the connector can be configured (via the 'Select maximum price for product' setting) to either select the highest or lowest applicable sales price.
Currency Handling: Price lists are generated for each configured currency, with currency rates fetched from NewBase. The 'Used currency codes' setting allows filtering which currencies are processed.
Image Handling
The connector synchronizes product images from NewBase to App4Sales.
Source: Images are referenced by a URL provided in
NewBaseProduct.ImageUrl.Process: The connector downloads the image from the specified URL.
Control: The 'Do not sync item pictures' setting can be used to disable image synchronization.
Stock & Availability
Stock levels are synchronized from NewBase, with options for specific warehouse filtering and handling of exact values.
Stock Source: Stock information is retrieved from the NewBase API.
Warehouse Specificity: The 'Warehouse ID for stock' setting allows administrators to specify a particular warehouse whose stock should be synchronized. If not set, a default warehouse (ID 1) is used.
Item Code Adjustment for Stock Calls: To accurately retrieve stock, the item code sent to NewBase can be modified using the 'Item prefix to remove for stock' and 'Item prefix to use for stock' settings. This is useful for ERP systems that use different item code formats for stock lookups.
Exact Stock Values: The 'Do not use exact stock values' setting allows for obfuscation of precise stock quantities. If enabled, any positive stock value will be represented as 1, any negative as -1, and zero as 0.
Composition Products (V4): For NewBase API V4, the 'Calculate stocks for composition products' setting influences how stock is calculated for products composed of multiple components.
Matrix & Attributes
The connector maps various product attributes and classifications to App4Sales ItemClasses and ItemCategories.
ItemClasses: A single ItemClass (ID 100) is created to represent the "Productgroep" (or custom name from setting). The value for this ItemClass is derived from
NewBaseProductGroupInfo, which contains grouping information from NewBase.ItemCategories: Several product details are mapped as ItemCategories:
"Extra description" from
NewBaseProduct.ExtraDescription."Remark" from
NewBaseProduct.Remark."Remark composition" from
NewBaseProduct.RemarkComposition.Custom categories are generated from
NewBaseProductPropertyentities, combining the display text of their category and property type.V4 Specific: Additional "Extra description" categories are created for multi-language extra descriptions from
NewbaseProductDescription.ProductDescrExtra.
Free Fields: The 'FreeSortField' can be populated from the product remark, offering a flexible way to transfer specific numerical attributes.
Matrix/Variant Handling: The current implementation does not explicitly define or handle parent-child relationships for matrix items (e.g., product variants like size/color combinations). Attributes like
ItemClassesandItemCategoriesserve to classify products, but a formal matrix structure for overriding data between parent and child items is not directly evident in the item update logic.
Related Settings & Prerequisites
ApiVersion: (Required) Determines which NewBase API version (V2 or V4) to use for data retrieval.ProductGroupName: (Optional) Customizes the display name for the 'Productgroep' ItemClass. Defaults to "Productgroep".SkipDiscontinuedProducts: (Boolean) Iftrue, products marked as discontinued in NewBase will not be synchronized.SkipProductsWithoutSalesPrice: (Boolean) Iftrue, products without a sales price in NewBase will not be synchronized.SkipProductsWithNamePrefix: (String) Comma-separated list of prefixes. Products whose names start with any of these prefixes will be skipped during synchronization.UseProductRemarkAsFreeSort: (Boolean) Iftrue, the product's remark from NewBase will be used as the App4SalesFreeSortField.DoNotSyncItemPictures: (Boolean) Iftrue, product images will not be downloaded or synchronized.WarehouseIdForStock: (Integer) Specifies the ID of the NewBase warehouse from which stock levels should be retrieved. Defaults to1if not specified.ItemPrefixToRemoveForStock: (String) A prefix to be removed from the App4Sales item code before querying NewBase for stock.ItemPrefixToUseForStock: (String) A prefix to be added to the item code when querying NewBase for stock.NoExactValuesForStock: (Boolean) Iftrue, stock values will be generalized (1, -1, or 0) instead of showing exact quantities.UsedCurrencyCodes: (String) Comma-separated list of currency codes. Only price lists and prices matching these currencies will be synchronized.SelectMaximumPriceForProduct: (Boolean, V4 only) Iftrue, for products with multiple applicable prices, the highest sales price will be selected. Otherwise, the lowest will be selected.ApplyDiscountsDuringSyncItemPricesCall: (Boolean) Iftrue, discounts defined in NewBase price breaks will be applied to product sales prices during synchronization.SyncOnlyProductsWithSubscriptionTypes: (String, V4 only) Comma-separated list of subscription types. Only products with these subscription types will be synchronized.SyncOnlyServiceProducts: (Boolean, V4 only) Iftrue, only products marked as service products in NewBase will be synchronized.
Known Limitations
Matrix/Variant Handling: The current item update logic does not provide explicit mechanisms for managing complex matrix/variant product structures, such as distinct parent-child relationships where child items inherit and override specific attributes from a parent. ItemClasses and ItemCategories provide classification but not hierarchical variant management.
Image Limits: The connector downloads images one by one. Performance might be affected for items with a very large number of images.
Multi-language Description Limit: A maximum of 5 language-specific descriptions can be synchronized to App4Sales.