> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnilinker.pl/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync configuration

> Choose which kinds of ERP data sync, how the agent detects changes, and how often it runs.

A connection syncs only the kinds of data you give it a sync configuration for. You create one sync configuration
per entity type (products, brands, prices and so on) on the connection's **Sync Configuration** tab. Settings that
apply to the whole connection, such as the change tracking mode, live in the connection's **Edit Connection**
window.

<Warning>
  Data flows one way today: from your ERP to Omnilinker. The agent does not write to your ERP, whatever you choose for
  **Direction**, **Master Source** or **Delete Behavior**. See [What the settings do today](#what-the-settings-do-today).
</Warning>

## Add a sync configuration

You need the **Manage Sync Configuration** permission.

<Steps>
  <Step title="Open the connection">
    Open **ERP Integration** > **Connections**, and choose **Details** on the connection.
  </Step>

  <Step title="Add a configuration">
    On the **Sync Configuration** tab, click **Add Configuration**.
  </Step>

  <Step title="Choose the entity type">
    Pick an **Entity Type**. Each entity type can have one configuration per connection.
  </Step>

  <Step title="Load the provider defaults">
    Click **Load Provider Defaults** to fill in the values the provider recommends. If Omnilinker reports that no
    default is available, set the values from [Recommended values for Wapro](#recommended-values-for-wapro) yourself.
  </Step>

  <Step title="Create it">
    Check **Direction** and **Master Source**, then click **Create**. The configuration starts enabled.
  </Step>
</Steps>

Delete behavior and the timing settings are not in the **Add Configuration** window. To change them, edit the
configuration after you create it.

For Wapro, add a configuration for each of these entity types: **Product**, **Brand**, **Price Level**,
**Product Price**, **Warehouse** and **Stock**. The agent only sends products and brands when their configuration
exists and is enabled. Product prices and warehouses are sent unless you add their configuration and disable it.

## Edit, disable or delete a configuration

On the **Sync Configuration** tab, each row shows **Entity Type**, **Direction**, **Master Source** and whether it is
**Enabled** or **Disabled**.

* Click the edit icon to open **Edit Sync Configuration**.
* Click **Disable** to stop syncing that entity type, and **Enable** to resume.
* Click **Delete** to remove the configuration.

Changes reach the agent within a few minutes. The agent picks up new configuration on its next heartbeat, which runs
every minute, and checks for new configuration every 5 minutes in any case.

## Settings

### Basic settings

| Setting             | Options                                     | What it means                                                                                          |
| ------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **Direction**       | **From ERP**, **To ERP**, **Bidirectional** | The direction data should flow for this entity type. Choose **From ERP**.                              |
| **Master Source**   | **ERP**, **Catalog**                        | Which system owns this data. Choose **ERP**.                                                           |
| **Delete Behavior** | **Skip**, **Soft Delete**, **Hard Delete**  | What to do in the ERP when the item is deleted in Omnilinker. See [Delete behavior](#delete-behavior). |
| **Batch size**      | 1–1000                                      | How many changes the agent reads from the ERP change feed per batch for this entity type.              |

A new configuration defaults to **Bidirectional** and **ERP**. The Wapro defaults are **From ERP** and **ERP**.

### Sync triggers

**On Create**, **On Update** and **On Delete** (shown as **Sync on Create**, **Sync on Update** and **Sync on Delete**
when you add a configuration) say which kinds of change to sync. They are intended for syncing from Omnilinker to the
ERP. Changes from the ERP are applied whatever you tick here.

### Delete behavior

Delete behavior only concerns deletes going from Omnilinker to the ERP:

| Option          | Meaning                                                                                                                         |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Skip**        | Do not send deletes to the ERP. This is the default and the safest choice.                                                      |
| **Soft Delete** | Mark the item as inactive or discontinued in the ERP instead of deleting it.                                                    |
| **Hard Delete** | Delete the item in the ERP. This cannot be undone. A hard delete can break audit trails, invoices and stock history in the ERP. |

Omnilinker does not write to your ERP yet, so none of these options changes your ERP today. Leave it on **Skip**.

<Note>
  Deletes in the other direction do happen. When an article is deleted in Wapro, or stops being active for external
  systems, the agent reports it as deleted and Omnilinker deletes the matching catalog product. See
  [Wapro](/erp/providers/wapro#what-counts-as-a-deleted-product).
</Note>

### Advanced timing settings

Expand **Advanced Timing Settings** in **Edit Sync Configuration** to see these. When collapsed, a one-line summary
shows the current values.

| Section                         | Setting                   | Range                                           | Default                             |
| ------------------------------- | ------------------------- | ----------------------------------------------- | ----------------------------------- |
| **Primary Polling**             | **min** and **sec**       | 10 seconds to 1 hour                            | 60 seconds                          |
| **Hash-Based Change Detection** | **Enabled**               | On or off                                       | On                                  |
|                                 | **Check every (min)**     | 1 minute to 24 hours                            | 15 minutes                          |
|                                 | **Batch size**            | 100–100,000                                     | 10,000 in the Wapro product default |
| **Full Sync Schedule**          | **Run every (hr)**        | 1 hour to 7 days                                | 24 hours                            |
| **Outbox Publishing**           | **Outbox Batch Size**     | 1–1000, not more than **Cloud API Batch Limit** | 100                                 |
|                                 | **Cloud API Batch Limit** | 1–1000                                          | 100                                 |
|                                 | **Publish Interval**      | 1–60 seconds                                    | 5 seconds                           |
|                                 | **Max Retry Attempts**    | 1–10                                            | 5                                   |

### What the settings do today

Not every setting on this screen changes what the agent does in the current version. This table shows which ones the
agent uses.

| Setting                                                                                   | Used today?                                                                                                                                                                                                |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enabled or disabled                                                                       | Yes, for **Product**, **Brand**, **Product Price** and **Warehouse**. Price levels come with the daily reference data upload, and stock comes with product changes, whatever their own configuration says. |
| **Batch size** (basic settings)                                                           | Yes, as the per-batch size when the agent reads the WFM\_INT change feed.                                                                                                                                  |
| **Hash-Based Change Detection**: **Enabled**, **Check every**, **Batch size**             | Yes, in **Hash scan** mode, taken from the **Product** configuration (or **Brand**, if there is no product configuration).                                                                                 |
| **Outbox Batch Size**, **Cloud API Batch Limit**                                          | Yes. The agent uses the largest value across all of the connection's configurations.                                                                                                                       |
| **Direction**, **Master Source**, **Delete Behavior**, sync triggers                      | No. These matter once Omnilinker can write to the ERP.                                                                                                                                                     |
| **Primary Polling**, **Full Sync Schedule**, **Publish Interval**, **Max Retry Attempts** | No. The agent uses its own fixed intervals, listed in [How often data syncs](#how-often-data-syncs).                                                                                                       |

## Connection-wide sync settings

These settings apply to every entity type on the connection. Open **ERP Integration** > **Connections**, choose
**Edit** on the connection, and find them under **Sync Settings**. You need the **Edit ERP Connection** permission.

| Setting                          | What it does                                                                                                                                                                        |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Auto-provision warehouses**    | Creates an Omnilinker warehouse for each ERP warehouse you have not mapped. See [Reference items](/erp/reference-items#automatic-provisioning).                                     |
| **Auto-provision price levels**  | Creates a catalog price level for each ERP price level you have not mapped. See [Reference items](/erp/reference-items#automatic-provisioning).                                     |
| **Primary source warehouse ID**  | For ERPs that keep one product row per warehouse, the warehouse whose row supplies the product's details. Leave it on **— not set — (automatic fallback)** to let the agent choose. |
| **Change tracking mode**         | How the agent detects changes in the ERP: **Hash scan** or **WFM\_INT change tracking**. See below.                                                                                 |
| **Bundle (Zestaw) price source** | Where bundle prices come from: **Fixed — from ERP** or **Calculated — from components**. See [Bundle pricing](#bundle-pricing).                                                     |

### Change tracking mode

| Mode                         | How it works                                                                                                                                                                     | What it covers                                                                                          |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| **Hash scan** (default)      | The agent reads ERP records on a schedule, computes a fingerprint of the mapped fields and sends the records whose fingerprint changed. It makes no changes to the ERP database. | Products and brands.                                                                                    |
| **WFM\_INT change tracking** | The agent registers with Wapro's own change-tracking framework and reads the changes it records, about once a minute. A weekly reconciliation pass catches anything missed.      | Products, product prices, warehouses and stock. Brands are picked up by the weekly reconciliation pass. |

In both modes the agent also uploads price levels, warehouses and other reference data every day, and bundle
compositions every 6 hours.

Switching to **WFM\_INT change tracking** takes two steps, in this order:

<Steps>
  <Step title="Register change tracking on the agent">
    On the agent computer, open the tray app's settings. Under **ERP Change Tracking**, tick
    **I consent to Omnilinker registering change tracking in the WFM\_INT framework tables**, then click
    **Enable Change Tracking**. This writes to Wapro's framework tables, so the SQL login needs extra rights. See
    [Requirements](/erp/requirements#sql-server-login) and [Wapro](/erp/providers/wapro#what-the-agent-writes-to-your-database).
  </Step>

  <Step title="Switch the connection's mode">
    In the web app, choose **Edit** on the connection, set **Change tracking mode** to **WFM\_INT change tracking**
    and click **Save**.
  </Step>
</Steps>

The agent uses WFM\_INT only when both are true. If the connection asks for WFM\_INT but the agent is not registered,
the agent keeps using hash scan. The **Agent** tab on the connection shows the mode the agent is actually using.

To go back, set **Change tracking mode** to **Hash scan**. To also remove the registration from the ERP database,
click **Disable Change Tracking** in the tray app.

<Warning>
  Registering change tracking again later marks every record as new, so the agent sends your whole catalog again as a
  full backfill.
</Warning>

### Bundle pricing

**Bundle (Zestaw) price source** decides how the price of a bundle product imported from the ERP is stored:

| Option                           | Meaning                                                                                                                                                                                                                                                                                                                   |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Fixed — from ERP** (default)   | Bundle prices are taken as they are from the bundle article in the ERP.                                                                                                                                                                                                                                                   |
| **Calculated — from components** | Bundle prices are calculated from the component prices: the sum of the component net prices, taxed at the bundle's own VAT rate. They are recalculated when the composition or a component price changes. The ERP still decides which price levels exist, and its bundle price is used when a component price is missing. |

This setting affects bundle products only. Simple products are unchanged.

## How changes flow

From the ERP to Omnilinker, every change takes the same path:

1. The agent detects the change in the ERP database, using hash scan or WFM\_INT.
2. The agent saves it in its local outbox before it marks the change as read in the ERP. If the internet connection
   drops, changes wait in the outbox.
3. Every 5 seconds the agent sends pending changes to Omnilinker over HTTPS, in compressed batches.
4. Omnilinker applies your [field mappings](/erp/field-mappings) to products and brands, then creates or updates the
   catalog product, brand, price level or price. Warehouse and stock changes go to Inventory.
5. Each change is recorded on the connection's **Sync Logs** tab. See [Monitoring](/erp/monitoring).

Omnilinker skips a change, rather than failing it, when something it depends on is not there yet. For example, a
price whose price level is not mapped, or stock for a product that has not arrived yet. These changes are applied
later, once the dependency exists. See [Reference items](/erp/reference-items#what-happens-to-unmapped-items).

When changes arrive out of order, Omnilinker keeps the newest. An update carrying an older ERP timestamp than the one
already applied is skipped.

### From Omnilinker to the ERP

Writing to the ERP is not available yet. Editing a product in Omnilinker does not change it in the ERP. The next change
to that product in the ERP overwrites the fields that come from the ERP.

## How often data syncs

These are the agent's defaults.

| What                                               | When                                                                                                                            |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Changes from WFM\_INT change tracking              | Every 60 seconds                                                                                                                |
| Hash scan (**Hash scan** mode)                     | Every 15 minutes by default (the **Check every** value of the product configuration), starting 2 minutes after the agent starts |
| Reconciliation (**WFM\_INT change tracking** mode) | Weekly, and after the agent detects a Wapro upgrade                                                                             |
| Price levels, warehouses and other reference data  | When the agent starts, then daily                                                                                               |
| Bundle compositions                                | When the agent starts, then every 6 hours                                                                                       |
| Sending queued changes to Omnilinker               | Every 5 seconds                                                                                                                 |
| Configuration refresh                              | Within about a minute of a change, and at least every 5 minutes                                                                 |

The agent's own intervals are set on the agent computer. See [Configuration reference](/erp/configuration-reference).

## Initial sync

There is no separate full-sync setting. The first sync happens on its own:

* **Hash scan**: on the first scan the agent has no fingerprints yet, so it sends every product and brand.
* **WFM\_INT change tracking**: registration marks every existing record as new, so the agent sends everything. It
  sends reference data and warehouses first, then products and stock, then prices, so that each item's dependencies
  arrive before it.

A first sync of a large catalog can take hours. Adding a field to the fingerprint (see
[Include in hash check](/erp/field-mappings#change-detection)) also makes the next hash scan send every product
again.

<Warning>
  The **Trigger Sync** button on the connection page does not start a sync on the agent in the current version. It
  records a failed sync attempt on the connection instead. To run a sync now, use **Sync Now** in the tray app. See
  [Tray app](/erp/tray-app).
</Warning>

## Recommended values for Wapro

These are the Wapro provider's defaults, which **Load Provider Defaults** fills in.

| Entity type       | Direction    | Master Source | Batch size | Hash check | Check every |
| ----------------- | ------------ | ------------- | ---------- | ---------- | ----------- |
| **Product**       | **From ERP** | **ERP**       | 100        | On         | 15 min      |
| **Brand**         | **From ERP** | **ERP**       | 50         | On         | 60 min      |
| **Price Level**   | **From ERP** | **ERP**       | 20         | On         | 60 min      |
| **Product Price** | **From ERP** | **ERP**       | 500        | Off        | —           |
| **Warehouse**     | **From ERP** | **ERP**       | 20         | Off        | —           |
| **Stock**         | **From ERP** | **ERP**       | 500        | Off        | —           |

All use **Skip** for **Delete Behavior**. Product prices, warehouses and stock need
[WFM\_INT change tracking](#change-tracking-mode).

## Next steps

<CardGroup cols={2}>
  <Card title="Field mappings" icon="arrow-left-right" href="/erp/field-mappings">
    Choose which ERP fields fill which Omnilinker fields.
  </Card>

  <Card title="Reference items" icon="list" href="/erp/reference-items">
    Map ERP price levels and warehouses.
  </Card>
</CardGroup>
