Source ERP · 9 of 11
CRMPro → MDC — Sage 50 UK: what the shipped templates set up
Read it in the terminal with "dlake skills show dlake-crmpro-mdc/erps/sage-50-uk". It extends the dlake-crmpro-mdc skill, which holds what is true whatever the source ERP.
CRMPro → MDC — Sage 50 UK: what the shipped templates set up
Keep this skill current.
dlakeships updates often and this text is embedded in the CLI you have installed. Before relying on it, comparedlake --versionwithnpm view @commercient/dlake version; if they differ, runnpm install -g @commercient/dlake@latestand thendlake 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-mdc is the destination skill this page is a child of, and the authority for the MDC
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-mdc/erps/sage-50-uk.md, and that skill’s ERP table
is what points at it. What follows is only what the shipped Sage 50 UK → MDC templates themselves
set, read from their Insert_Query, CreateViewQuery and MappingJson. This page grows as the
catalogue does.
1. What the templates deliver
| Group | Business outcome | Objects | Source tables and views |
|---|---|---|---|
| CRM UoMSchedule | The templates push uomschedule to MDC. | uomschedule | — |
| CRM UOM | The templates push uom to MDC. | uom | — |
| CRM PriceLevel | The templates push pricelevel to MDC. | pricelevel | SF_ERP_Salesforce_Clone_STOCK |
| CRM Product | The templates push product to MDC. | product | SF_ERP_Salesforce_Clone_STOCK |
| CRM salesorder | The templates push salesorder to MDC. | salesorder | SF_ERP_Salesforce_Clone_SOP_ITEM, e, SF_ERP_Salesforce_Clone_STOCK, SF_ERP_Salesforce_Clone_SALES_ORDER, ctepricelist, SF_ERP_Salesforce_Clone_SALES_LEDGER |
| CRM salesorderdetail | The templates push salesorderdetail to MDC. | salesorderdetail | SF_ERP_Salesforce_Clone_SOP_ITEM, SF_ERP_Salesforce_Clone_SALES_ORDER, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_SALES_DEL_ADDR |
| CRM invoice | The templates push invoice to MDC. | invoice | SF_ERP_Salesforce_Clone_INVOICE_ITEM, e, SF_ERP_Salesforce_Clone_STOCK, SF_ERP_Salesforce_Clone_INVOICE, ctepricelist, SF_ERP_Salesforce_Clone_SALES_LEDGER |
| CRM invoicedetail | The templates push invoicedetail to MDC. | invoicedetail | SF_ERP_Salesforce_Clone_INVOICE_ITEM, SF_ERP_Salesforce_Clone_INVOICE, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_SALES_DEL_ADDR |
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 name | CRM_Object_API_Name | CRM_PK_API_Name | Sync_Order | TimeStamp_Prefix | SQL_Query target | field prefix / postfix | Sync_Operation_Type |
|---|---|---|---|---|---|---|---|
| CRM UoMSchedule | uomschedule | name | 20 | UOMSchedule: | vw_CRM_UOMSchedule | '' / '' | 1 |
| CRM UOM | uom | name | 21 | UOM: | vw_CRM_UOM | '' / '' | 1 |
| CRM PriceLevel | pricelevel | comrcint_externalkey | 22 | CRM_PriceBook: | vw_SAGE50UK_CRM_PriceLevel | '' / '' | 1 |
| CRM Product | product | comrcint_externalkey | 23 | vw_SAGE50UK_CRM_Product: | vw_SAGE50UK_CRM_Product | '' / '' | 1 |
| CRM salesorder | salesorder | comrcint_externalkey | 24 | vw_SAGE50UK_STD_SalesOrder: | vw_SAGE50UK_STD_SalesOrder | '' / '' | 1 |
| CRM salesorderdetail | salesorderdetail | comrcint_externalkey | 25 | vw_SAGE50UK_STD_SalesDetail: | vw_SAGE50UK_STD_SalesDetail | '' / '' | 1 |
| CRM invoice | invoice | comrcint_externalkey | 26 | vw_SAGE50UK_STD_InvoiceHeader: | vw_SAGE50UK_STD_InvoiceHeader | '' / '' | 1 |
| CRM invoicedetail | invoicedetail | comrcint_externalkey | 27 | vw_SAGE50UK_STD_InvoiceDetail: | vw_SAGE50UK_STD_InvoiceDetail | '' / '' | 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 '',
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.
| View | Change detection | Repository key | Reads other prefixes | Identity column | Source tables |
|---|---|---|---|---|---|
vw_CRM_UOMSchedule | — | — | name | — | |
vw_CRM_UOM | — | — | name | — | |
vw_SAGE50UK_CRM_PriceLevel | — | CRM_PriceBook: | comrcint_externalkey | SF_ERP_Salesforce_Clone_STOCK | |
vw_SAGE50UK_CRM_Product | insert + update | — | vw_SAGE50UK_CRM_Product: | comrcint_externalkey | SF_ERP_Salesforce_Clone_STOCK |
vw_SAGE50UK_STD_SalesOrder | insert + update | — | CRM_PriceBook:, vw_CRM_Account:, vw_SAGE50UK_Customer:, vw_SAGE50UK_STD_SalesOrder: | comrcint_externalkey | SF_ERP_Salesforce_Clone_SOP_ITEM, e, SF_ERP_Salesforce_Clone_STOCK, SF_ERP_Salesforce_Clone_SALES_ORDER, ctepricelist |
vw_SAGE50UK_STD_SalesDetail | insert + update | — | vw_SAGE50UK_STD_SalesOrder:, vw_SAGE50UK_CRM_Product:, vw_SAGE50UK_STD_SalesDetail: | comrcint_externalkey | SF_ERP_Salesforce_Clone_SOP_ITEM, SF_ERP_Salesforce_Clone_SALES_ORDER, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_SALES_DEL_ADDR |
vw_SAGE50UK_STD_InvoiceHeader | insert + update | — | CRM_PriceBook:, vw_CRM_Account:, vw_SAGE50UK_Customer:, vw_SAGE50UK_STD_InvoiceHeader: | comrcint_externalkey | SF_ERP_Salesforce_Clone_INVOICE_ITEM, e, SF_ERP_Salesforce_Clone_STOCK, SF_ERP_Salesforce_Clone_INVOICE, ctepricelist |
vw_SAGE50UK_STD_InvoiceDetail | insert + update | — | vw_SAGE50UK_STD_InvoiceHeader:, vw_SAGE50UK_CRM_Product:, vw_SAGE50UK_STD_InvoiceDetail: | comrcint_externalkey | SF_ERP_Salesforce_Clone_INVOICE_ITEM, SF_ERP_Salesforce_Clone_INVOICE, SF_ERP_Salesforce_Clone_SALES_LEDGER, SF_ERP_Salesforce_Clone_SALES_DEL_ADDR |
4. Order of work
The templates set Sync_Order to 20, 21, 22, 23, 24, 25, 26, 27. A run processes
active rows in ascending Sync_Order, which is the order the templates put them in:
20— CRM UoMSchedule21— CRM UOM22— CRM PriceLevel23— CRM Product24— CRM salesorder25— CRM salesorderdetail26— CRM invoice27— CRM invoicedetail
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_SAGE50UK_CRM_PriceLevelreadsCRM_PriceBook:; no template in this set writesCRM_PriceBook:vw_SAGE50UK_CRM_Productreadsvw_SAGE50UK_CRM_Product:; no template in this set writesvw_SAGE50UK_CRM_Product:vw_SAGE50UK_STD_SalesOrderreadsCRM_PriceBook:,vw_CRM_Account:,vw_SAGE50UK_Customer:,vw_SAGE50UK_STD_SalesOrder:; no template in this set writesCRM_PriceBook:,vw_CRM_Account:,vw_SAGE50UK_Customer:,vw_SAGE50UK_STD_SalesOrder:vw_SAGE50UK_STD_SalesDetailreadsvw_SAGE50UK_STD_SalesOrder:,vw_SAGE50UK_CRM_Product:,vw_SAGE50UK_STD_SalesDetail:; no template in this set writesvw_SAGE50UK_STD_SalesOrder:,vw_SAGE50UK_CRM_Product:,vw_SAGE50UK_STD_SalesDetail:vw_SAGE50UK_STD_InvoiceHeaderreadsCRM_PriceBook:,vw_CRM_Account:,vw_SAGE50UK_Customer:,vw_SAGE50UK_STD_InvoiceHeader:; no template in this set writesCRM_PriceBook:,vw_CRM_Account:,vw_SAGE50UK_Customer:,vw_SAGE50UK_STD_InvoiceHeader:vw_SAGE50UK_STD_InvoiceDetailreadsvw_SAGE50UK_STD_InvoiceHeader:,vw_SAGE50UK_CRM_Product:,vw_SAGE50UK_STD_InvoiceDetail:; no template in this set writesvw_SAGE50UK_STD_InvoiceHeader:,vw_SAGE50UK_CRM_Product:,vw_SAGE50UK_STD_InvoiceDetail:
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.
| Template | Object | Mapped fields | First ERP → MDC pairs |
|---|---|---|---|
| CRM UoMSchedule | uomschedule | 2 | name → name, baseuomname → baseuomname |
| CRM UOM | uom | 2 | name → name, uomschedule__uomscheduleid__lookup → uomschedule__uomscheduleid__lookup |
| CRM PriceLevel | pricelevel | 3 | STOCK_CODE → comrcint_externalkey, STOCK_CAT_NAME → name, DESCRIPTION → description |
| CRM Product | product | 6 | STOCK_CODE → name, STOCK_CODE → productnumber, STOCK_CODE → comrcint_externalkey, DESCRIPTION → description, DefaultUOMSchedule.SFDCID → uomschedule__DefaultUoMScheduleId__lookup |
| CRM salesorder | salesorder | 20 | ORDER_NUMBER → comrcint_externalkey, NAME → Name, ADDRESS_1 → billto_line1, ADDRESS_2 → billto_line2, ADDRESS_3 → billto_city |
| CRM salesorderdetail | salesorderdetail | 15 | ORDER_NUMBER, ITEM_NUMBER, JOB_NUMBER → comrcint_externalkey, ORDER_NUMBER, ITEM_NUMBER, JOB_NUMBER → Name, ADDRESS_1 → shipto_line1, ADDRESS_2 → shipto_line2, ADDRESS_3 → shipto_city |
| CRM invoice | invoice | 22 | ADDRESS_1 → BillTo_Line1, ADDRESS_2 → BillTo_Line2, ADDRESS_3 → BillTo_City, ADDRESS_4 → BillTo_StateOrProvince, ADDRESS_5 → BillTo_PostalCode |
| CRM invoicedetail | invoicedetail | 14 | INVOICE_NUMBER, ITEM_NUMBER → comrcint_externalkey, INVOICE_NUMBER, ITEM_NUMBER → Name, ADDRESS_1 → shipto_line1, ADDRESS_2 → shipto_line2, ADDRESS_3 → shipto_city |
6. 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:
UOMSchedule:UOM:CRM_PriceBook:vw_SAGE50UK_CRM_Product:vw_SAGE50UK_STD_SalesOrder:vw_SAGE50UK_STD_SalesDetail:vw_SAGE50UK_STD_InvoiceHeader:vw_SAGE50UK_STD_InvoiceDetail:
7. 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 → MDC templates set up. dlake-crmpro-mdc is the destination
skill this page sits under: its own text is the authority for the MDC 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.