Retail Offline Sync Service fails to synchronize

Last week I had a case where my Retail Offline Sync Service stopped working.

A little background first. This is the topology for a Retail store and what this post is all about.

POST001_Retail_Sync_Topology

The POS has to be in „Work offline mode“ so that it checks its own database. If the POS is in “Online mode” it will check the store database.

POST001_Retail_Sync_Work_offline

Let’s get back to our problem. I added a new Expense account to my store expecting it will be replicated to my offline POS database.

POST001_Retail_Sync_Adding_expense

We go to our POS that is currently in offline mode and try to add an expense. To our surprise the new expense account is not present.

POST001_Retail_Sync_Expense_account_store

The first thing we check is if the expense account is even replicated to the store database. So we log into the POS that is directly connected to the store database and check expense accounts. Sure enough the account is there.

POST001_Retail_Sync_Expense_account_offline

The first conclusion is that there is a problem with the Offline Sync Service in the store. By default the tracing on the Offline Sync Service is not enabled. To enable the tracing we need to change the config file. The config file on your computer with the offline POS database is located in:

C:Program Files (x86)Microsoft Dynamics AX60Retail POSRetailOfflineMicrosoft.Dynamics.Retail.Offline.Service.exe.config

Append the next code to the config file:

</configuration>
…
  <system.diagnostics>

    <switches>
    <!--  0-off, 1-error, 2-warn, 3-info, 4-verbose. -->
      <add name="SyncTracer" value="3" />
    </switches>

    <trace autoflush="true">

      <listeners>
        <add name="Tracing" type="System.Diagnostics.TextWriterTraceListener" initializeData="SyncTrace.log" />
      </listeners>
    </trace>
  </system.diagnostics>
…
</configuration>

In the “SyncTracer” value field you can specify how much info we want from the tracer. We will put this to “info” to see a little more information. After all is done and finished don’t forget to switch the tracing to “off” because the trace file can become rather large.

After we changed the config file we restart the offline sync service just in case.

POST001_Retail_Sync_Restart_service

The log file  SyncTrace.log is created in the same folder as the config file. We open the log file and this is what we see.

ERROR , Microsoft.Dynamics.Retail.Offline.Service, 7, 04/13/2014 09:56:14:123, LocalConnectionStringMissing

It’s telling us that some connection string is missing. So we open up the config file for the offline sync service again and check the connection strings. This is what we see:

    <connectionStrings>
        <add name="Microsoft.Dynamics.Retail.Offline.Service.Properties.Settings.LocalDBConnectionString"
            connectionString="" />
        <add name="Microsoft.Dynamics.Retail.Offline.Service.Properties.Settings.RemoteDBConnectionString"
            connectionString="Data Source=AX62POS-ZG-01;Initial Catalog=RetailSplitStore;Integrated Security=True;Persist Security Info=False;Pooling=True;Encrypt=True;TrustServerCertificate=True" />
    </connectionStrings>

Apparently the connection string for the offline database is missing. The connection string for the remote database (the store database) is correct. We fix the connection string and restart the service:

   <connectionStrings>
        <add name="Microsoft.Dynamics.Retail.Offline.Service.Properties.Settings.LocalDBConnectionString"
            connectionString="Data Source=AX62POS-ZG-02;Initial Catalog=RetailSplitStoreT2;Integrated Security=True;Persist Security Info=False;Pooling=True;Encrypt=True;TrustServerCertificate=True" />
        <add name="Microsoft.Dynamics.Retail.Offline.Service.Properties.Settings.RemoteDBConnectionString"
            connectionString="Data Source=AX62POS-ZG-01;Initial Catalog=RetailSplitStore;Integrated Security=True;Persist Security Info=False;Pooling=True;Encrypt=True;TrustServerCertificate=True" />
    </connectionStrings>

TIP: To check if the data is replicated we could just connect to the databases and check the tables. Sometimes it’s a much faster way to check replication instead of going through the POS. This is the store database data in the RETAILINCOMEEXPENSEACCOUNTTABLE table (the one with the income and expense accounts). We can see that our new expense account is present:

POST001_Retail_Sync_Store_db

This is the offline POS database data for the same table:

POST001_Retail_Sync_Offline_db

The account is still missing. We open up the SyncTrace.log again and see this:

INFO, Microsoft.Dynamics.Retail.Offline.Service, 7, 04/13/2014 10:04:53:132, Terminal Offline: YES

The catch is that it won’t sync the database unless we get the POS back into online mode! Once we do that the account is replicated to the offline database.

POST001_Retail_Sync_Offline_db_ok

We take the POS offline again and try to add an expense account and sure enough it’s there:

POST001_Retail_Sync_Offline_expense_ok

I hope you enjoyed the tips&tricks of the offline sync service. Until next time!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s