Source ERP · 6 of 7

CRMPro → Magento — Sage 50 UK: what the shipped templates set up

Read it in the terminal with "dlake skills show dlake-crmpro-magento/erps/sage-50-uk". It extends the dlake-crmpro-magento skill, which holds what is true whatever the source ERP.

CRMPro → Magento — Sage 50 UK: what the shipped templates set up

Keep this skill current. dlake ships updates often and this text is embedded in the CLI you have installed. Before relying on it, compare dlake --version with npm view @commercient/dlake version; if they differ, run npm install -g @commercient/dlake@latest and then dlake skills install, which overwrites the installed skill files with the current text.

dlake-crmpro is the parent skill and the authority for everything general: the crmpro_* tools, CRM_Configuration and CRM_FieldList, TimeStampRepository, the three kinds of source view, the NULL-cursor rule and the silent zero-record run. Read it first; this page does not repeat it. dlake-crmpro-magento is the destination skill this page is a child of, and the authority for the Magento conventions that hold across every ERP: read it first, then come back here for what this source’s own templates set. This page is dlake-crmpro-magento/erps/sage-50-uk.md, and that skill’s ERP table is what points at it. The catalogue spells this destination MEGENTO, so that is the value to pass as a tool argument — dlake admin crmpro_templates --crmName MEGENTO — but the product is Magento, which is what this page calls it. What follows is only what the shipped Sage 50 UK → Magento templates themselves set, read from their Insert_Query, CreateViewQuery and MappingJson. This page grows as the catalogue does.

1. What the templates deliver

GroupBusiness outcomeObjectsSource tables and views
MAGENTO_GetProductThe templates push products to Magento. New records are created, existing ones updated, and records removed in the ERP are deleted.products
MAGENTO_CustomerUpdateKeyERP SF_CUSTOMERSFROMMAGENTO, SALES_LEDGER, SF_COUNTRY_REGION data becomes customers in Magento. New records are created, existing ones updated, and records removed in the ERP are deleted.customersSF_CustomersFromMagento, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_RM00102, Matched_Customers, Countries, vw_MAGENTO_SAGE50UK_GetCountryCode

2. The process rows the templates create

Each template’s Insert_Query writes one CRM_Configuration row. These are the values it sets; a column the inserts never set is not listed.

Display nameCRM_Object_API_NameCRM_PK_API_NameSync_OrderTimeStamp_PrefixSQL_Query targetfield prefix / postfixSync_Operation_Type
MAGENTO_GetProductproductsExternalKey0vw_GetProductSelect 1=0'' / ''1
MAGENTO_CustomerUpdateKeycustomersExternalKey0vw_Customervw_MAGENTO_SAGE50UK_CustomerUpdate_Pro'' / ''1

Every one of these inserts Is_Active as 0, so an imported process is inactive until an operator activates it. Across the set they insert Is_Create_Entity 0, Is_Create_Fields 0, Is_Active_Get_Records 0, Is_Active_Delete_Records 0, IsAccountMatching False, Sync_Batch_Size 200. Text columns a template does not use are inserted as '' rather than left NULL.

3. The views

Each template creates its view with CreateViewQuery, in the gateway dbo schema. “Change detection” names which of the three kinds dlake-crmpro defines the view’s own WHERE makes it; where a view’s shape is not one of those three the column is left empty and the view’s own WHERE is the authority.

ViewChange detectionRepository keyReads other prefixesIdentity columnSource tables
vw_MAGENTO_SAGE50UK_CustomerUpdate_Proinsert-onlyvw_Customer:vw_Get_Customer:ExternalKeySF_CustomersFromMagento, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_RM00102, Matched_Customers, Countries

The repository key these templates build is <TimeStamp_Prefix>:<key>. The literal in the view and the TimeStamp_Prefix on the configuration row have to be the same string, case included.

4. Order of work

These views read another process’s repository prefix, which is what makes the order a dependency order: the row appears in the view only once the process that writes that prefix has run, so a parent flows on one run and its children on the next.

  • vw_MAGENTO_SAGE50UK_CustomerUpdate_Pro reads vw_Get_Customer:; no template in this set writes vw_Get_Customer:

5. Field mapping

CRM_FieldList carries one row per pushed column, with Object_Name equal to the CRM_Object_API_Name value — as dlake-crmpro puts it, an object with no CRM_FieldList rows pushes nothing and records no error. Each template carries its intended mapping in MappingJson. Read that with dlake admin crmpro_templates, then check crmpro_field_mapping on the created process before activating it.

TemplateObjectMapped fieldsFirst ERP → Magento pairs
MAGENTO_CustomerUpdateKeycustomers9emailemail, FirstNameFirstName, LastNameLastName, CUSTOMATTR_commercient_idCUSTOMATTR_commercient_id, CUSTOMATTR_customer_numberCUSTOMATTR_customer_number

6. Community templates

The catalogue carries 4 community templates for this pair. A community template is authored in a tenant rather than shipped with the product, and it imports the same way as any other. Its own names, notes, field mapping and SQL are tenant content, so what this section states is what the set amounts to: how many templates there are, what they default to doing, which destination objects they write and which groups they fall in. They are not part of the shipped set described above.

  • Templates: 4
  • Default operations: insert on 4, update on 4, delete on 4
  • Marked circular-sync: 0
  • Licence groups they span: 1
  • Destination objects: customers, product, products, stockitems
  • Object display names: MAGENTO_CustomerUpdateKey, MAGENTO_GetProduct, MAGENTO_Product, MAGENTO_Update_Inventory

A community template is imported the way a shipped one is, and the same rules apply to what it creates: read the process it creates with crmpro_get_process, its mapping with crmpro_field_mapping, and the view it selects from, before activating it.

7. Verifying

# per-prefix counts; every synced record carries its destination id
dlake tool query --profile <tenant> --sql "SELECT LEFT([Key], CHARINDEX(':',[Key])-1) AS prefix, COUNT(*) n, COUNT(NULLIF(SFDCID,'')) withId FROM dbo.TimeStampRepository WHERE CHARINDEX(':',[Key])>0 GROUP BY LEFT([Key], CHARINDEX(':',[Key])-1)"

withId = n for every prefix is the success condition dlake-crmpro defines. The split is on the first colon, which is the prefix boundary whether the key separator is : or ::.

The prefixes these templates set:

  • vw_GetProduct
  • vw_Customer

8. Where this sits

dlake-crmpro is the general operating surface — the crmpro_* tools, the setup and transaction tables, field mapping, and the source-view contract that applies to every destination. This page adds what the shipped Sage 50 UK → Magento templates set up. dlake-crmpro-magento is the destination skill this page sits under: its own text is the authority for the Magento conventions that hold across every ERP, and its ERP table lists this page alongside every sibling ERP page for this destination. For the extract leg that fills the clone tables, see dlake-normalsync; for the on-premises agent that runs it, dlake-syncagent; for the writeback leg, dlake-txdownloaderpro; for standing an integration up, dlake-integration-setup.