Why Business Central Rejects API Data: Understanding Validation Errors and Posting Setup - CloudFronts

Why Business Central Rejects API Data: Understanding Validation Errors and Posting Setup

Why Business Central Rejects API Data: Understanding Validation Errors and Posting Setup

Summary

Integrating Microsoft Dynamics 365 Business Central with CRM, Project Operations, or other business applications is not simply a matter of sending valid JSON to an API. A payload can be syntactically correct, reach the Business Central endpoint successfully, and still be rejected because Business Central applies data-type rules, master-data validation, posting setup, document dependencies, and business logic.

This article looks at common integration failures encountered when moving data between business applications and Business Central. The examples cover posting groups, missing references, document dependencies, Edm.Date, Edm.Decimal, Edm.Int32, Liquid transformations, lookup relationships, and transactional sequencing.

The objective is practical: understand what the error is really telling you, determine whether the problem is in the source, mapping, API payload, master data, or Business Central configuration, and correct the root cause instead of repeatedly retrying the same request.

1. Introduction: When an API Request Isn’t Enough

In an integration project, the first assumption is often that a successful HTTP request means the data has been accepted. In Business Central, that is only part of the story.

A request can successfully reach an API endpoint and still fail when Business Central validates the record. The platform may check whether a customer exists, whether a posting group is configured, whether a referenced item or project is available, whether a value has the expected OData data type, or whether the transaction satisfies the rules required for posting.

Key idea: HTTP/API success and Business Central business-process success are two different things. An integration is successful only when the destination accepts the data and the resulting record behaves correctly in Business Central.

This distinction becomes especially important in integrations involving Dynamics 365 Project Operations, Dataverse, Logic Apps, and Business Central. Source systems and Business Central may use different field names, identifiers, data types, and record relationships.

For example, a source system may expose a project through a Dataverse lookup while Business Central expects a project number. A time-entry source may provide a duration in minutes while the target process expects hours. A date-time value may be returned from the source even though the Business Central API field is a date-only field.

These are not necessarily API connectivity problems. They are integration and business-validation problems.

2. Where an Integration Error Can Occur

A useful way to troubleshoot an integration is to divide it into stages:

  1. Source retrieval: Data is read from CRM, Project Operations, Dataverse, or another source.
  2. Transformation: Fields are renamed, filtered, formatted, or converted using Liquid or another transformation mechanism.
  3. Payload generation: The transformed values are serialized into JSON.
  4. API transmission: The request is sent to the Business Central endpoint.
  5. Business Central validation: Business Central validates field types, references, setup, and business rules.
  6. Record creation or update: The record is created or updated.
  7. Posting or downstream processing: Additional Business Central logic may validate the transaction when it is posted or processed.

The important point is that the error message should be interpreted according to the stage where the failure occurred.

Failure AreaTypical SymptomFirst Place to Investigate
Source dataMissing or unexpected valueOriginal source record
TransformationWrong or blank mapped valueLiquid/template output
JSON serializationMalformed JSON or incorrect JSON typeActual outgoing payload
API/ODataEndpoint, method, or schema errorURL, API contract, response
Business Central validationPosting group, reference, field, or business-rule errorBC record and setup
PostingRecord exists but transaction cannot postPosting setup and transaction configuration

3. Missing Posting Groups and Setup

The problem:

A customer or transaction can contain the correct name, number, amount, and other mapped values and still be rejected because Business Central does not have the required posting configuration.

Business Central uses posting groups and related setup to determine how business transactions are represented in the general ledger and other ledgers. Depending on the record and transaction, this can involve customer posting groups, vendor posting groups, general product posting groups, VAT posting groups, inventory posting setup, and other configuration.

Example: Customer Posting Group Validation

Consider an integration creating or updating a customer with a posting group value:

{
  "displayName": "Apex Manufacturing",
  "customerPostingGroup": "DOMESTIC"
}

The JSON can be valid, but Business Central can reject the value if the referenced posting group is not available in the target company or if the value does not match the destination setup.

What makes this different from a mapping error?

If the outgoing payload contains the intended value but Business Central cannot resolve that value against its setup, changing the JSON syntax will not solve the problem. The destination configuration must also be checked.

What to check in Business Central

  • Open the relevant customer, vendor, item, or setup page.
  • Identify the posting-group field mentioned by the error.
  • Check whether the corresponding setup record exists in the same Business Central company and environment.
  • Confirm that the source-to-target mapping uses the correct Business Central code.
  • Check related VAT, general posting, or product posting setup where applicable.
Fix:

First determine whether the value is supposed to come from source master data or from Business Central configuration. If it is a destination-controlled value, create or configure the required setup in Business Central rather than attempting to invent a value in the integration.

Takeaway: A mapping can be technically correct and still fail because the destination master data or posting setup is incomplete.

4. Missing References and Document Dependencies

The problem:

Business Central transactions rarely exist in isolation. A sales invoice can depend on a customer, an item line depends on an item or another valid line type, and project-related transactions can depend on projects, tasks, resources, dimensions, or other master data.

One common integration design mistake is to send dependent transactional data before the master record that it references has been created or synchronized.

Example: Project Reference

Suppose Project Operations exposes a project through a Dataverse lookup. The integration may receive a lookup identifier, but Business Central needs a meaningful target identifier such as the Project No.

A source record might conceptually contain:

{
  "_msdyn_project_value": "source-project-guid",
  "subject": "Conveyor Cell Automation"
}

The integration should not assume that the Dataverse GUID is automatically the Business Central Project No. A lookup or expansion can be used to retrieve the source project’s integration identifier, such as an int_sourceid, and that value can then be mapped to the corresponding Business Central project.

Fix:

Validate the complete relationship chain: source lookup → source project identifier → Business Central project number → destination record.

Recommended dependency sequence

  1. Synchronize or confirm master data.
  2. Validate the identifier used by the destination.
  3. Create the parent/header record.
  4. Create dependent lines or transactions.
  5. Process or post the transaction only after prerequisites are satisfied.

This sequencing is particularly important for integrations involving customers, vendors, products/items, projects, resources, dimensions, payment terms, and transactional documents.

5. Incorrect Data Types and Formats

OData-based Business Central APIs expose field types that must be respected by the integration. A value that looks reasonable to a developer may still be incompatible with the target field.

5.1 Date and Edm.Date Errors

Illustrative error:
Cannot convert the literal '9/22/2026 12:00:00 AM'
to the expected type 'Edm.Date'.

This type of error occurs when a date-time representation is sent to a field that expects an OData date-only value.

For example, a source value may look like:

{
  "msdyn_date": "9/22/2026 12:00:00 AM"
}

If the Business Central target expects a date, passing that string unchanged can fail.

Correct transformation concept

If the source is already an ISO-style value such as 2026-09-22T00:00:00Z, extracting the date portion can produce:

{% assign rawDate = entry.msdyn_datetimezoneindependent %}
{% assign formattedDate = rawDate | slice: 0, 10 %}

"Posting_Date": "{{ formattedDate }}"

The resulting value is:

"Posting_Date": "2026-09-22"
Important: Do not blindly use slice: 0, 10 for every date source. First inspect the actual source representation. Locale-formatted dates such as 9/22/2026 12:00:00 AM are not equivalent to an ISO timestamp and may require a different transformation strategy.
How to troubleshoot:
  • Identify the exact target field.
  • Confirm whether it is a date or date-time field.
  • Inspect the source value before transformation.
  • Inspect the final serialized value sent to Business Central.
  • Check whether time-zone conversion is relevant.

5.2 Decimal and IEEE754Compatible Errors

Decimal values can create subtle integration issues because OData and JSON serialization have rules around numeric precision and representation.

Illustrative scenario:

A destination API expects an Edm.Decimal value, but the generated request represents the value in an incompatible way or the integration serializes it according to a different numeric convention.

Example

{
  "Unit_Price": "10000"
}

If the target API expects a JSON number, the payload may instead need to represent the value as:

{
  "Unit_Price": 10000
}

However, the correct representation must always be determined from the target API contract. Some OData configurations use specific serialization behavior for decimal values, and an integration should not assume that every endpoint treats numeric strings and JSON numbers identically.

Business example: Unit Cost vs Unit Price

In a project invoice integration, the business meaning of the line type can also determine which numeric field should be populated.

{% if line_type == "Budget" %}
{
  "Line_Type": "Budget",
  "Unit_Cost": 50
}
{% elsif line_type == "Billable" %}
{
  "Line_Type": "Billable",
  "Unit_Price": 50
}
{% endif %}

This illustrates an important distinction: a technically valid decimal value can still be mapped to the wrong business field.

Takeaway: Validate both the data type and the business meaning of a numeric field.

5.3 Edm.Int32 and Empty-Value Errors

Integer fields create another common issue. A source may return an empty string when a value is unavailable:

{
  "Line_No": ""
}

If the Business Central API expects an Edm.Int32, an empty string is not an integer.

A safer transformation pattern is to decide explicitly what should happen when the source is empty:

{% if entry.line_number %}
  "Line_No": {{ entry.line_number }}
{% endif %}

For fields where the integration itself generates a number, the transformation can calculate it instead. For example, a line sequence might be constructed from a base value plus an increment.

{% assign lineNo = 30000 | plus: index | times: 10000 %}

The exact expression should be tested against the Liquid engine used by the integration platform and the numbering rules of the destination process.

How to troubleshoot:
  • Check the target field’s data type.
  • Inspect whether the source value is null, empty, numeric, or text.
  • Do not send an empty string to an integer field.
  • Do not convert business identifiers to integers unless the target field actually expects an integer.

6. Mapping and Transformation Problems

Even when the source and destination APIs are available, the transformation layer can introduce errors.

Example: Liquid Variable Mismatch

{% assign data = source.value %}

{% for _data in data %}
{
  "PrimaryId": "{{ _data.accountid }}",
  "Name": "{{ account.name }}"
}
{% endfor %}

The loop uses _data, while the name is being read from account.name. Unless account has been defined elsewhere, the expected value may not be produced.

Corrected example

{% assign data = source.value %}

{% for _data in data %}
{
  "PrimaryId": "{{ _data.accountid }}",
  "Name": "{{ _data.name }}"
}
{% endfor %}
Mapping checks:
  • Confirm the loop variable.
  • Confirm the exact source property name.
  • Check lookup properties and expanded properties separately.
  • Inspect the generated payload rather than only the template.
  • Test with one record before processing a large batch.

7. Lookup and Relationship Handling

Dataverse and Business Central both use relationships between records, but the way those relationships are exposed can differ.

A lookup field may provide a GUID while the integration actually needs a related business identifier such as an account number, vendor number, project number, or document number.

Example: Retrieving a Related Invoice Value

For an invoice-detail integration, the detail record can be related to its invoice through a navigation property. Instead of treating a lookup identifier as the final business value, the integration can expand the related invoice and select the required fields.

$expand=Invoices($select=name,cf_sourceid)

The exact navigation property and entity relationship must be verified against the Dataverse metadata for the environment. The important integration principle is that a lookup identifier and a business identifier are not automatically interchangeable.

Takeaway: When an integration needs a value from a related record, explicitly retrieve and map that related value. Do not assume that the lookup GUID is the same identifier used by Business Central.

8. Document Numbers and Transaction Dependencies

Transactional integrations often have another layer of dependency: the header and its lines.

For example, an invoice line may contain an item, quantity, price, and dimensions, but it may also need to belong to a valid invoice header. If the document number is missing, generated differently than expected, or not available at the point where the line is created, the transaction can fail or produce an unexpected result.

Example

{
  "Document_No": "",
  "Type": "Item",
  "No": "1968-S",
  "Quantity": 1,
  "Unit_Price": 10000
}

Before investigating the item or price, determine whether the line has a valid relationship to its document header and whether the API is designed to generate the document number or expects the integration to provide it.

Recommended approach:
  1. Create or identify the document header.
  2. Capture the destination document identifier.
  3. Use that identifier when creating related lines.
  4. Validate item, customer/vendor, dimensions, and amounts.
  5. Only then proceed to posting or further processing.

This is also why a record can exist in Business Central but still fail later during posting: creation and posting are separate stages with different validation requirements.

9. A Practical Troubleshooting Workflow

Step 1: Read the Full Error

Do not start by changing the mapping. First read the complete response. Look for the field name, expected type, referenced record, company, endpoint, and validation message.

Step 2: Identify the Failing Stage

Determine whether the failure occurred during retrieval, transformation, serialization, API transmission, Business Central validation, or posting.

Step 3: Inspect the Actual Outgoing Payload

This is one of the most valuable debugging steps. The transformation template may look correct while the generated JSON is not. Inspect the exact request sent to Business Central.

Step 4: Check the Target Field

Confirm the Business Central field’s data type and business purpose. Ask whether the value should be a string, integer, decimal, date, GUID, code, or related-record identifier.

Step 5: Check Master Data and Setup

If the error refers to a customer, vendor, item, project, posting group, payment term, currency, dimension, or other setup value, verify that it exists in the target company.

Step 6: Check Dependencies

Confirm that prerequisite records have already been synchronized. A transaction cannot reliably reference a record that has not been created or cannot be resolved.

Step 7: Correct One Issue at a Time

Make a targeted correction and test with a controlled record. Changing multiple parts of the integration at once can hide the original root cause.

Step 8: Verify the Result in Business Central

A successful HTTP response should not be the final verification point. Open the resulting record and confirm the mapped values, relationships, dimensions, and business behavior.

Recommended mindset: Trace the value from source → transformation → outgoing JSON → Business Central field → related setup/master data → final transaction. This makes troubleshooting much more systematic.

10. Best Practices for Reliable Integrations

  • Document source-to-target mappings: Record source property, target field, data type, transformation, and dependency.
  • Validate master data first: Synchronize customers, vendors, items, projects, resources, currencies, dimensions, and other prerequisites before transactions.
  • Validate the final payload: Do not rely only on the transformation template. Inspect the actual serialized JSON.
  • Respect Business Central configuration: Posting groups and related setup are part of the integration landscape, not just application administration.
  • Use meaningful defaults carefully: A default value should represent a valid business rule, not merely make an API request pass.
  • Separate transient and permanent errors: Network failures may be retryable; invalid data and missing setup usually require correction first.
  • Design safe retries: Make sure retrying a create operation does not unintentionally create duplicate records.
  • Test edge cases: Include nulls, empty strings, missing references, invalid dates, decimal precision, and unexpected source values.
  • Log enough context: Capture correlation IDs, record identifiers, endpoint information, and sanitized error responses without exposing credentials or confidential data.
  • Test in a controlled environment: Validate mapping and posting behavior before sending integration changes to production.

11. Integration Debugging Checklist

Before sending the request

  • ☐ Required source fields are populated.
  • ☐ Target field names are correct.
  • ☐ JSON syntax is valid.
  • ☐ Dates use the expected format.
  • ☐ Numeric fields contain compatible values.
  • ☐ Empty strings are not being sent to incompatible numeric/date fields.

Before blaming the API

  • ☐ The actual outgoing payload has been inspected.
  • ☐ The target field’s data type has been confirmed.
  • ☐ Related customer/vendor/item/project records exist.
  • ☐ Posting groups and relevant setup exist in the target company.
  • ☐ Parent documents are created before dependent lines.

After a successful response

  • ☐ The destination record exists.
  • ☐ Mapped values are correct.
  • ☐ Related records resolve correctly.
  • ☐ Dimensions and other business data are correct.
  • ☐ Posting or downstream processing behaves as expected.

12. Common Errors at a Glance

Error CategoryPossible CauseRecommended Check
Posting group validationRequired setup is missing or mapping uses an invalid codeCheck the relevant Business Central setup and outgoing value
Reference not foundCustomer, vendor, item, project, resource, or other prerequisite is missingVerify the record exists in the target company
Edm.Date errorDate-time or locale-formatted value sent to a date-only fieldInspect source format and serialized target value
Edm.Decimal errorIncorrect numeric representation or incompatible serializationCheck target data type and actual JSON value
Edm.Int32 errorEmpty string or non-integer value sent to an integer fieldCheck null/empty handling and target type
Incorrect Liquid mappingWrong variable or source propertyCompare source JSON with transformed output
Lookup mismatchSource GUID used where a business identifier is requiredExpand or retrieve the related record and map the correct identifier
Document dependencyLine created without valid header/document relationshipConfirm header creation and document number flow
Posting failureRecord exists but posting setup or business rules are incompleteValidate posting groups, dimensions, accounts, tax setup, and related configuration

13. Frequently Asked Questions

1. Why can Business Central reject valid JSON?

Valid JSON only confirms that the payload follows JSON syntax. It does not prove that Business Central accepts the field types, values, references, posting setup, or business rules contained in that JSON.

2. Is every validation error an API error?

No. The API may simply be the channel through which Business Central reports a business validation failure. The underlying problem may be master data, configuration, a missing relationship, or an invalid business value.

3. How do I know whether the problem is Liquid or Business Central?

Inspect the transformed payload immediately before the API request. If the value is already wrong or missing, investigate the source or transformation. If the payload is correct, investigate the Business Central API contract, master data, setup, and validation rules.

4. Should I retry a failed request?

Not automatically. Retry transient failures such as selected connectivity problems according to the integration’s retry strategy. Validation errors generally need a correction before another attempt.

5. Why should consultants understand posting setup when working on integrations?

Because integration data often becomes operational or financial data in Business Central. A technically correct mapping can still fail or produce incorrect processing if the destination’s posting groups and related configuration do not support the transaction.

14. Conclusion

Reliable Business Central integrations require more than correct API endpoints and valid JSON. They require an understanding of the destination application’s data types, master data, relationships, posting configuration, and business rules.

The most effective troubleshooting approach is to follow the data end to end: inspect the source, inspect the transformation, inspect the exact outgoing payload, identify the Business Central field that is failing, verify related records and setup, and then test the corrected transaction in a controlled environment.

Final takeaway: An integration should be considered successful only when the data is technically valid, Business Central accepts it according to its business rules, and the resulting record behaves correctly in the intended business process.

About the Author

Adelle D’Souza

Trainee Consultant

Adelle D’Souza is a Trainee Consultant at CloudFronts Technologies, working with Microsoft Dynamics 365 Business Central and application integrations. Her work includes data mapping, API troubleshooting, Business Central development, integration workflows, and report customization.

Connect: LinkedIn

Examples in this article are sanitized or illustrative representations of integration scenarios. API field names, navigation properties, setup requirements, and accepted formats can vary by Business Central version, API endpoint, environment, and implementation.


Share Story :

SEARCH BLOGS :

FOLLOW CLOUDFRONTS BLOG :


Categories

Secured By miniOrange