This article describes the standard integration between Younium and Dynamics BC.
Data flows at a glance
| Flow | Direction |
|---|---|
| Invoice posting | Younium → BC |
| Credit memos | Younium → BC |
| Customers (accounts) | BC → Younium |
| Products (items) | BC → Younium |
| Currencies | BC → Younium |
| Exchange rates | BC → Younium |
| Payment terms | BC → Younium |
| Chart of accounts | BC → Younium |
| Dimensions | BC → Younium |
Authentication
Azure AD - OAuth 2.0 client credentials
The integration uses service-to-service authentication via an Azure AD app registration. No user login is required at runtime.
Setup steps
- Create an App Registration in Azure AD.
- Create a corresponding Azure AD Application in Business Central and grant it sufficient API permissions.
Full Microsoft instructions: Automation APIs using S2S Authentication
Credentials required in Younium
| Field | Description |
|---|---|
| Base URL | https://api.businesscentral.dynamics.com/v2.0/{TenantId}/{EnvironmentName}/ODataV4/ |
| BC Company | Exact company name in BC - used to verify the connection on activation |
| Active Directory Tenant ID | Your Azure AD tenant ID |
| Client ID | Application ID from the Azure AD app registration |
| Client Secret | Authentication secret from the Azure AD app registration |
| SSL bypass validation | Optional - bypasses SSL certificate validation. Only enable this for development or sandbox environments, never production. |
Required OData pages in BC
The following standard BC pages must be accessible via OData before activating the integration:
| Page | Number |
|---|---|
| PaymentTerm | 4 |
| Currency | 5 |
| ChartOfAccount | 16 |
| CustomerCard | 21 |
| Item | 31 |
| GeneralLedgerSetup | 118 |
| CurrencyExchangeRate | 483 |
| Dimension | 536 |
| DimensionValue | 537 |
| SalesInvoice | 43 |
| SalesCreditMemo | 44 |
| InvoiceLine | 47 |
| InvoiceCreditLine | 96 |
The following fields must be added to pages 43 and 44 (SalesInvoice / SalesCreditMemo):
- Sell_to_Customer_No
- Bill_to_Customer_No
- WorkDescription
The following fields must be added to pages 47 and 96 (InvoiceLine / InvoiceCreditLine):
- Document_No
- Line_No
Activation and Deactivation
Activating the integration
- In Younium, go to Settings → Integrations → Dynamics 365 Business Central.
- Click Get started.
- Enter the credentials listed above.
- Click Activate - Younium queries BC to verify the company name. On success, the integration is marked active.
During activation, Younium automatically creates the following custom fields.
Do not rename or delete them - they are referenced by name in the integration code.
| Entity | Custom field name | Notes |
|---|---|---|
| Account | Dynamics NAV Customer Number | Stores the BC customer number |
| Product | Dynamics NAV Product Number | Stores the BC item number |
| Charge | Dynamics NAV Product Number | Stores the BC item number |
| OrderProductCharge | Dynamics NAV Product Number | Used when building invoice lines |
| Invoice | Dynamics NAV Invoice Number | BC document number, written back after posting |
| Invoice / Order | Dynamics NAV EAN Number | Created only when Has EAN Number is enabled |
| Charge / OrderProductCharge / InvoiceLine | Dynamics NAV Deferral Code | List of available deferral templates |
Deactivating the integration
Go to Settings → Integrations → Dynamics 365 Business Central and click Deactivate. This removes all stored credentials and unsubscribes the invoice posting event. Custom fields created during activation remain in Younium and can be reused if the integration is reactivated.
Configuration settings
All settings are available after activation under Settings → Integrations → Dynamics 365 Business Central.
| Setting | What it does |
|---|---|
| Create Invoices | Enables automatic invoice posting to BC when an invoice is posted in Younium. This is the master switch - it controls the event subscription. |
| EAN Number | Activates the Dynamics NAV EAN Number custom field on invoices and orders. Maps to OIOUBL_GLN in BC. Max 13 characters - enforced at posting time. |
| Map External Document Number | Maps "Your Order Number" from Younium to External_Document_No in BC. |
| Don't send recurring fees with 0 amount | Filters out zero-amount recurring invoice lines before posting. Zero-price lines that are included will have Unit_Price explicitly set to 0 - this prevents BC from applying the item's default list price. |
| Map Unit Price and Quantity | When enabled, maps actual unit price and quantity to BC line fields. When disabled, quantity is always 1 and price equals the line subtotal. |
| Allow Multiple Orders | Allows invoices that span multiple Younium orders. Lines are grouped by account. The account name is inserted as a comment line before each group; an empty comment line follows as a separator. |
| Use Dimension | Enables dimension values on invoice lines. Requires both Dimension Code and Invoice Line Dimension Custom Field to be configured - the sync job fails if either is missing. |
| Enable Custom Mapping | Enables custom field mapping between Younium and BC for invoice headers and accounts. |
| Map Product Comment Lines | When enabled, comment lines posted to BC include a configured product number (CommentLineProductNo). |
| Export Journal | Enables export of accounting journals from Younium to BC as general journal entries. Requires Custom Service URL to be configured. |
Synchronization jobs
All jobs check that the integration is active before running. Jobs are configured and scheduled under Settings → General → Scheduled Jobs.
| Job | Direction | Sync behaviour |
|---|---|---|
| Import Dynamics 365BC accounts | BC → Younium | Incremental - only records modified since last sync |
| Import Dynamics 365BC products | BC → Younium | Incremental - only records modified since last sync |
| Import Dynamics 365BC currencies | BC → Younium | Full fetch every run |
| Import Dynamics 365BC exchange rates | BC → Younium | Full fetch every run |
| Import Dynamics 365BC payment terms | BC → Younium | Full fetch every run |
| Import Dynamics 365BC financial accounts | BC → Younium | Full fetch every run |
| Import Dynamics 365BC dimensions | BC → Younium | Full fetch every run |
Importing accounts (BC → Younium)
Fetches all BC customers modified since the last sync date
Currency requirement. The Younium base currency must match the Local Currency (LCY) code in BC's General Ledger Setup. This is checked on every account sync run and on every invoice post - the job stops if they differ.
Behaviour rules
- Customers with Blocked = ALL or Blocked = INVOICE that do not yet exist in Younium are skipped entirely.
- Blocked customers that already exist in Younium are synced and marked inactive.
- If a customer's currency does not exist in Younium, that customer is skipped and a failure is logged. Other customers continue processing.
- Custom field mappings (if Enable Custom Mapping is on for accounts) are applied on top of the standard field mapping.
Account field mapping (BC → Younium)
| BC field (CustomerCard) | Younium field |
|---|---|
| No | Custom field: Dynamics NAV Customer Number |
| Name | Account Name |
| Home_Page | Domain |
| VAT_Registration_No | Tax Registration Number |
| Currency_Code | Currency (falls back to base currency if empty) |
| Payment_Terms_Code | Default Payment Term |
| Salesperson_Code | Sales Reference |
| ContactName | Your Reference |
| Blocked (ALL / INVOICE) | Inactive |
| Address / Address_2 | Invoice Address Street / Street 2 |
| City / Post_Code | Invoice Address City / Zip |
| Country_Region_Code | Invoice Address Country (2- or 3-alpha code) |
Importing products (BC → Younium)
Fetches all BC items modified since the last product sync. Each item is matched to a Younium product by the Dynamics NAV Product Number custom field.
Behaviour rules
- Items without a description in BC are skipped and logged as errors.
- If no matching product exists in Younium, a new product is created with a default charge plan and a single charge using the Quantity charge model.
- If a matching product exists, the product name, charge plan name, and charge name are updated.
- Products previously synced from BC that are no longer present in the BC item list are marked end-of-sale in Younium (set to today's date).
- Dynamics NAV Product Number is set on both the Product and the Charge.
Product field mapping (BC → Younium)
| BC field (Item) | Younium field |
|---|---|
| No | Custom field: Dynamics NAV Product Number on Product and Charge |
| Description | Product Name, Charge Plan Name, Charge Name |
| Unit_Price | Charge Detail price (if charge details exist and price is set) |
Importing payment terms (BC → Younium)
Fetches all BC payment terms. Only day-based terms with no discount are supported.
Skipped terms are logged. A term is skipped if:
- It has a Discount_Date_Calculation value (discount terms are not supported).
- Its Due_Date_Calculation does not contain D (only day-based terms are supported).
- Its Due_Date_Calculation contains more than one letter (e.g. compound formats are not supported - only formats like 30D are accepted).
Existing payment terms are updated if the description or number of days has changed.
Payment term field mapping (BC → Younium)
| BC field | Younium field | Notes |
|---|---|---|
| Code | PaymentTerm.Name | Match key |
| Description | PaymentTerm.Description | Updated if changed |
| Due_Date_Calculation | PaymentTerm.Days | Numeric portion of the D format, e.g. 30D → 30 days |
| Always NetDays | PaymentTerm.TermType |
Importing chart of accounts (BC → Younium)
Fetches all accounts from BC's ChartOfAccount endpoint. Only accounts with Account_Type = POSTING are imported. Account names are updated if changed in BC.
Financial account field mapping (BC → Younium)
| BC field | Younium field | Notes |
|---|---|---|
| No | FinancialAccount.Code | Match key |
| Name | FinancialAccount.Name | Updated if changed |
Importing currencies (BC → Younium)
Fetches all currencies from BC. New currencies not already present in Younium are created. Existing currencies are not updated - Code is the match key (case-insensitive).
Currency field mapping (BC → Younium)
| BC field | Younium field |
|---|---|
| Code | Currency.Code |
| Description | Currency.Description |
Importing exchange rates (BC → Younium)
Fetches all exchange rates from BC's CurrencyExchangeRate endpoint. The rate is calculated as Relational_Exch_Rate_Amount / Exchange_Rate_Amount. Currencies not yet present in Younium are skipped.
Exchange rate field mapping (BC → Younium)
| BC field | Younium field |
|---|---|
| Currency_Code | CurrencyExchangeRate.FromCurrency |
| Younium base currency | CurrencyExchangeRate.ToCurrency |
| Relational_Exch_Rate_Amount / Exchange_Rate_Amount | CurrencyExchangeRate.Rate |
| Starting_Date | CurrencyExchangeRate.EffectiveFromDate |
Importing dimensions (BC → Younium)
Fetches all values for a configured dimension code from BC. Values are stored as items in a custom field list on invoice lines.
Requirements - both must be configured before the job runs:
- Dimension Code - the BC dimension to import (e.g. DEPARTMENT).
- Invoice Line Dimension Custom Field - the Younium invoice line custom field that will hold the dimension value. It must be a List type and reference a valid custom field list.
Behaviour: New dimension values are added to the list. Existing values are updated if the name has changed.
Invoice posting (Younium → BC)
When an invoice is posted in Younium, the InvoicePosted event fires and the integration automatically creates a Sales Invoice or Sales Credit Memo in BC.
Credit memos. Any invoice with a negative total amount (TotalAmount.Amount < 0) is posted as a SalesCreditMemo. Prices on lines are negated - BC expects positive amounts on credit memo lines.
Prerequisites
All of the following must be in place before an invoice can post successfully:
- Younium base currency matches BC LCY code (checked on every post).
- The account has Dynamics NAV Customer Number populated.
- Every invoice line has Dynamics NAV Product Number populated on its charge.
- The account's payment term exists in BC.
- EAN number does not exceed 13 characters (if the EAN setting is enabled).
Behaviour rules
- Credit memos: any invoice with a negative total amount is posted as a SalesCreditMemo. Prices on lines are negated - BC expects positive amounts on credit memo lines.
- Lines are sent in order of ProductLineNumber ascending, then ChargeNumber ascending - matching the order they appear in the Younium order.
- Each line is patched immediately after creation to force Line_Discount_Percent = 0
- If a Younium line price is 0, Unit_Price is also explicitly patched to 0 after line creation
- For non - One-Off lines with a service period, a comment line is added in BC with the service period dates (YYYY-MM-DD to YYYY-MM-DD).
- Line notes are split on line breaks and chunked to 100 characters each, with each chunk posted as a separate comment line.
- Multi-order invoices (when Allow Multiple Orders is enabled): lines are grouped by account. A comment line with the account name is inserted before each group; an empty comment line follows as a separator.
- On success, the BC document number is written back to the Dynamics NAV Invoice Number custom field on the Younium invoice and to ExternalERPId.
Invoice header field mapping (Younium → BC)
| Younium field | BC field | Notes |
|---|---|---|
| Invoice.Notes | WorkDescription | |
| Account Dynamics NAV Customer Number | Sell_to_Customer_No | unless overridden by custom mapping |
| Invoice.YourOrderNumber | External_Document_No | only if Map External Document Number is enabled |
| Dynamics NAV EAN Number custom field | OIOUBL_GLN | only if Has EAN Number is enabled; max 13 chars |
| Invoice type | Document_Type | Invoice or Credit Memo |
| Invoice.InvoiceDate | Document_Date, Posting_Date | |
| Invoice.DueDate | Due_Date | |
| Account.DefaultPaymentTerm.Name | Payment_Terms_Code | |
| Invoice.TotalAmount.CurrencyCode | Currency_Code | only if non-base currency |
| Invoice.YourReference | Your_Reference | |
| Invoice.OurReference | Salesperson_Code | |
| Account Dynamics NAV Customer Number | Bill_to_Customer_No | unless in custom mappings |
Invoice line field mapping (Younium → BC)
| Younium field | BC field | Notes |
|---|---|---|
| OrderProductCharge custom field Dynamics NAV Product Number | No | Required - posting fails if missing |
| InvoiceLine.ChargeDescription | Description | |
| Quantity | Quantity | Always 1 unless Map Unit Price and Quantity is enabled |
| Price | Unit_Price, Line_Amount | Line subtotal unless Map Unit Price and Quantity is enabled; negated for credit memos |
| Deferral code (resolved from custom field list) | Deferral_Code | Only if a matching deferral list item is found |
| Service period start date | Configurable BC field | Defaults to EDX_Returns_Deferral_Start_Date |
| Dimension value (resolved from custom field list) | ShortcutDimCode{1–8} | Position resolved from GeneralLedgerSetup.Shortcut_Dimension_{i}_Code |
| Always 0 | Line_Discount_Percent | Patched after line creation |
Write-back (BC → Younium)
| BC field | Younium field |
|---|---|
| Document No | Custom field Dynamics NAV Invoice Number |
| Document No | Invoice.ExternalERPId |
Deferral codes
Invoice lines in Younium can be mapped to BC deferral templates. The Dynamics NAV Deferral Code custom field is available on charges, order product charges, and invoice lines.
When an invoice line has a service period and this field is populated, the integration:
- Looks up the matching deferral list item by value.
- Formats the list item's key using the rounded period length (e.g. the key R{0:D2} becomes R06 for a 6-month period).
- Posts Deferral_Code and the service period start date to the BC line.
A BC customisation is required to use deferral codes. Contact your Younium implementation team before enabling this feature. The service period start date field name in BC is configurable via the DeferralServicePeriodStartDateCustomMapping setting. The default is EDX_Returns_Deferral_Start_Date.
Troubleshooting
Cannot connect to BC
- Verify the Base URL format exactly: https://api.businesscentral.dynamics.com/v2.0/{TenantId}/{EnvironmentName}/ODataV4/
- Confirm the BC Company name matches exactly what is configured in BC (the connection test is case-sensitive).
- Confirm the Azure AD app has the required BC API permissions.
- Check the integration log for the token fetch error message.
- Check network connectivity and firewall settings - the Younium service must be able to reach the BC OData endpoint.
- If using SSL bypass validation, confirm this is only enabled for development or sandbox environments.
Invoice posting fails
- LCY mismatch - check BC General Ledger Setup and the Younium base currency under Settings → Legal Entity. They must match exactly.
- Missing customer number - populate Dynamics NAV Customer Number on the account.
- Missing product number - populate Dynamics NAV Product Number on every charge linked to the invoice.
- Payment term not found - sync payment terms first, or add the term manually in BC.
- EAN number too long - EAN values must be 13 characters or fewer.
- Line discount cleared - this is expected behaviour. The integration always patches Line_Discount_Percent = 0.
- Zero-price line shows item list price - if the item list price appeared briefly before the patch ran, this is expected. The integration patches Unit_Price = 0 immediately after creation.
Synchronization failures
- Currency missing - sync currencies before syncing accounts or products. A customer's currency must exist in Younium before that customer can be imported.
- Payment terms skipped - check the integration log for "has discount" or "support only days" messages. BC terms with discounts or formats other than {n}D are not supported and will always be skipped.
- Dimension sync fails - confirm that both Dimension Code and Invoice Line Dimension Custom Field are set in the integration settings.
- Individual record failures do not stop the full sync run. Check the log for created / updated / failed counts.
Best practices
- Synchronize master data in this order before enabling invoice posting: currencies → payment terms → chart of accounts → customer accounts. Currency must exist in Younium before an account using that currency can be imported.
- Test invoice posting in a sandbox or non-production BC environment before enabling in production.
- Review synchronization logs regularly to catch and resolve issues early.
- Maintain consistent customer and product numbers between Younium and BC. The integration matches on these identifiers - discrepancies will cause duplicate records or failed postings.
- If using EAN numbers, verify values are 13 characters or fewer before enabling the setting.
- Keep custom field mappings up to date when BC fields or Younium field configurations change.