Replication

Commerce Service has an interface to replicate data from LS Central via Commerce over to eCommerce.

More detailed information on what data is replicated can be found online for each function. The functions are:

Product Setup

ReplEcommItems

ReplEcommUnitOfMeasures

ReplEcommItemUnitOfMeasures

ReplEcommItemVariants

ReplEcommItemVariantRegistrations

ReplEcommExtendedVariants

ReplEcommAttribute

ReplEcommAttributeOptionValue

ReplEcommAttributeValue

ReplEcommBarcodes

ReplEcommBasePrices

ReplEcommPrices

ReplEcommDiscounts

ReplEcommMixAndMatch

ReplEcommDiscountValidations

ReplEcommFullItem

ReplEcommImageLinks

ReplEcommImages

ReplEcommItemCategories

ReplEcommProductGroups

ReplEcommCollection

ReplEcommItemModifier

ReplEcommItemModifier

ReplEcommInventoryStatus

ReplEcommHierarchy

ReplEcommHierarchyLeaf

ReplEcommHierarchyNode

ReplEcommHierarchyHospDeal

ReplEcommHierarchyHospDealLine

ReplEcommHierarchyHospModifier

ReplEcommHierarchyHospRecipe

ReplEcommValidationSchedule

 

Basic Data

ReplEcommCountryCode

ReplEcommCurrency

ReplEcommCurrencyRate

ReplEcommDataTranslation

ReplEcommDealHtmlTranslation

ReplEcommDataTranslationLangCode

ReplEcommMember

ReplEcommCollection

ReplEcommShippingAgent

ReplEcommStores

ReplEcommStoreTenderTypes

ReplEcommTaxSetup

ReplEcommVendor

ReplEcommVendorItemMapping

All functions take in a ReplRequest object that tells what data to get, and return a Response object with a list of records and other information about the status of the replication.

A Full Replication takes all the data from the source table. Full Replication should be done, when a new store has been set up or data for a store needs to be recovered or restored again. When doing an Update Replication, LS Central PreActions are used to get all affected records since last Replication, and lastKey will point to last PreAction counter, which should be sent in every time an Update Replication is performed. If lastKey and maxKey are set to 0, all affected records with PreAction in LS Central will be replicated.

Note: When doing Full Replication, lastKey will include a timestamp that is needed to get next batch of data. Keep the FullReplication value as true while getting all batches of data in Full Replication till the RecordsRemaining becomes 0. At that point lastKey will include latest PreAction counter that should be used when Update replication will be done.

For deleted data, Update Replication will include that record with key data and property IsDeleted set to true.

Some of the functions support Store distribution. You can set the StoreId in the replication request to replicate only data relevant to that particular store.

Full Replication replicates all the data from LS Central and will return the latest PreAction counter when done as LastKey, except Price and Discount replication will store last PreAction count in MaxKey value as LastKey is used for table time stamp. Update Replication will look for any changes made from LastKey and MaxKey since the last Full or Update Replication was made. LastKey and MaxKey for each Replication function should be stored locally.

You will get data back when doing Full Replication but after Full Replication, Update Replication will be empty as LastKey will point to the last record in LS Central. To get some data, either do some changes to the data in LS Central and then run Update Replication again or run Update Replication first after starting up the web sample. Adding this line of code before the while loop will reset the LastKey value so Update Replication will always return all available data from PreActions.

The ReplEcommFullItem function returns an Item with a list of Variants, Unit of Measures, Attributes, and Prices.

ReplEcommImages will return an Image in base64 string format. This data can be used directly on a web page by adding the string to WebControl Image control.

Image1.ImageUrl = "data:image/jpeg;base64," + replImage.Image64;

ReplEcommInventoryStatus gets current Inventory status.

To set up what products are included in the replication, run the POS Inventory Lookup command in the Product Groups page in LS Central to generate the Lookup Lines for the stores and products that should be replicated.

The data is stored in the Inventory Lookup Table in LS Central.

Run Scheduler Job COMMERCE_INVENTORY (10012871) to update the Inventory status. This job needs to run regularly to keep inventory up to date.

Replication is only picking up the value in the last column, Net Inventory, that gets calculated by the scheduler job.

All UCService.ReplXxxxResponse Objects include a list Object with the data record that is being replicated. LastKey and MaxKey have the last point in time or last PreAction Id during and after replication. MaxKey in most functions shows the highest PreAction Id that is expected after replication is done, but in some it used to store delta value. RecordsRemaining shows how many records are left to pull, and when it reaches 0, all records have been delivered.

Note: In some cases, replication will always return all records, as these are tables that do not have any PreAction set up and usually include a small amount of data that does not get updated frequently.

See also

Replication Code Sample