Dynamics 365 Business Central Data Migration: Common Mistakes, Risks, and How to Avoid Them - CloudFronts

Dynamics 365 Business Central Data Migration: Common Mistakes, Risks, and How to Avoid Them

When a Business Central API Request Fails: Finding the Real Cause | CloudFronts

Summary

Integrating Microsoft Dynamics 365 Project Operations with Microsoft Dynamics 365 Business Central involves more than transferring data between two systems. Project-related information such as customers, projects, timesheets, expenses, and invoices must be accurately synchronized to maintain consistency across project delivery and financial operations.

To simplify this process, CloudFronts developed the PO-BC Integration Module, an integration solution designed to connect Project Operations with Business Central. The app provides a structured approach to synchronizing project-related data while reducing manual effort and helping organizations maintain data consistency between both platforms.

In this article, we explore the key features of the PO-BC Integration Module and demonstrate how its integration capabilities help manage project data, handle transactions, and simplify cross-platform operations.

1. The Order Reaches Business Central. Why Does It Still Fail?

Imagine an order-taking application connected to Business Central. A sales representative enters an order for a domestic customer. The integration sends the customer reference, order information and line values to Business Central. The request reaches the API, but a later validation or posting step raises an error.

The first instinct is often to inspect the JSON and send it again. But what if the field values are correctly typed, the customer number is valid, and the missing piece is General Posting Setup or a required dimension?

The problem in this example:

The external application knows how to describe the order. Business Central must also decide whether that order is valid under its financial setup and transaction rules. Those are two different tests.

Here is how I would narrow it down: confirm the failing operation, read the complete response, compare the incoming values with the relevant Business Central record, then inspect the setup behind that record. We will use posting groups, dimensions, and Project Journal document numbers to illustrate three different failure points.

2. First Separate the API Error from the Business Rule

Before changing anything, ask a simple question: did Business Central reject the shape of the request, or did it reject what the request was trying to do? The answer determines which screen or line of JSON to investigate next.

An API request generally contains information such as field names, values, and identifiers. Business Central then processes the request based on the API definition and the validation logic associated with the underlying application.

Types of validation

Validation TypeWhat It ChecksExample
Mandatory field validationWhether required fields contain valuesDocument No. in a Project Journal
Data type validationWhether the supplied value matches the expected field typeInteger, decimal, date, or GUID
Reference validationWhether the referenced record existsCustomer No. or Item No.
Configuration validationWhether the required setup is availableCustomer Posting Group
Business rule validationWhether the data satisfies application rulesValid combinations of posting groups
Relationship validationWhether related records are correctly associatedDimensions assigned to a Sales Order

API validation versus business validation

It is useful to distinguish between two different situations.

API-level validation: The request may contain an invalid property, an incorrect data type, or a value that does not match the API definition.

Business-level validation: The request may satisfy the API’s structural requirements, but Business Central rejects it because the underlying record or configuration does not meet a business requirement.

For example, sending a string where an integer is expected is a data type issue. Sending a valid Customer No. without the required posting configuration is a different type of issue.

For the sample sales order, a number supplied as text points to the request. A missing posting combination points to Business Central setup. Repeating the same request will not create a missing setup record.

3. Follow the Posting Group Trail

Suppose the customer is found successfully, but the order fails when Business Central validates a posting combination. This is the point where I would leave Postman for a moment and open the relevant customer and posting setup pages in Business Central.

When transactions are posted, Business Central uses the relevant posting group configurations to identify the accounts and posting combinations required for the transaction.

A valid customer number does not guarantee a valid financial posting. Business Central must still resolve the relevant customer receivables account and the general/VAT posting combinations used by the transaction.

3.1 Start with the Customer Card

Customer Posting Groups are assigned to customer records and help determine the receivables accounts used when customer transactions are posted.

For example, a business may maintain different Customer Posting Groups for different customer categories.

CodeDescription
DOMESTICDomestic customers
EUCustomers in EU
FOREIGNForeign customers (not EU)

A customer can be associated with the appropriate posting group based on the organization’s accounting requirements.

Business Central Customer Card showing the Allow Multiple Posting Groups setting.

Fig 3.1: Customer Card showing the Allow Multiple Posting Groups setting in Business Central.

The Customer Card also contains a setting called Allow Multiple Posting Groups. When enabled, this setting supports the use of multiple Customer Posting Groups for the customer, depending on the applicable Business Central functionality and transaction requirements.

3.2 Inspect the Accounts Behind the Posting Group

The Customer Posting Group Card contains the configuration associated with a particular posting group.

For example, the DOMESTIC posting group contains fields such as:

  1. Code and Description.
  2. Receivables Account.
  3. Service Charge Account.
  4. Payment Discount Debit and Credit Accounts.
  5. Payment Tolerance Debit and Credit Accounts.
  6. Rounding-related accounts.
Business Central Customer Posting Group Card showing the DOMESTIC configuration.

Fig 3.2: Customer Posting Group Card displaying the configuration associated with the DOMESTIC posting group.

The configured accounts determine how relevant customer transactions are reflected in the General Ledger.

3.3 Check What the Sales Order Actually Uses

Posting group information is also visible on transaction documents such as Sales Orders.

The Sales Order contains fields including General Business Posting Group, VAT Business Posting Group, and Customer Posting Group.

Business Central Sales Order showing Posting Details and available Customer Posting Groups.

Fig 3.3: Posting Details section on a Sales Order, showing the available Customer Posting Groups.

Compare the order’s posting-group values with the customer, item and setup records. Then check the matching General Posting Setup and, where applicable, VAT Posting Setup combinations. The Customer Posting Group controls receivables posting; it does not replace those other configurations. The exact required setup depends on the transaction and localization.

Implementation consideration: A valid customer reference alone does not guarantee that a transaction can be posted. The related posting groups and posting setup must also satisfy the requirements of the transaction.

4. The Dimension Looks Valid-But Is It Attached to the Right Order?

Now imagine that the order gets past posting-group checks but the integration must also assign a reporting dimension. A dimension is not simply a label in JSON: it must point to a supported parent record and a valid dimension value in Business Central.

Organizations can use dimensions to analyze transactions by departments, projects, business groups, locations, or other reporting categories.

When creating or updating transactions through APIs, dimensions may also need to be assigned to the corresponding document.

4.1 Understanding Dimension Set Lines

Business Central provides dimension-related API functionality that allows dimension information to be associated with supported records.

For example, a Sales Order may have a dimension called Business Group, with a dimension value of HOME.

The dimension assignment requires information identifying the parent record, the dimension code, and the selected dimension value.

4.2 Walk Through a Sample Postman Request

In this illustrative request, the external application associates a Business Group dimension with a sales order. The parentId is a sample GUID, not a value to copy into another environment:

{
    "parentId": "28ac0679-16b4-ee11-a56a-000d3acbcb4a",
    "code": "BUSINESSGROUP",
    "valueCode": "Home"
}

The fields represent the following information:

FieldDescription
parentIdIdentifier of the parent record to which the dimension is associated
codeDimension code
valueCodeDimension value code

The request illustrates how BUSINESSGROUP may be associated with the parent record using a Home dimension value. Use the actual configured value code and a supported dimension API for your environment.

Postman request and response showing a Business Central dimension set line API call.

Fig 4.1: Postman request and response showing the dimension set line created through a Business Central API.

4.3 Understanding the API Response

After sending the request, Business Central returns a response containing information about the created dimension set line.

The response includes fields such as:

  1. id
  2. code
  3. parentId
  4. parentType
  5. displayName
  6. valueCode
  7. valueDisplayName

For the example above, the response identifies the dimension as BUSINESSGROUP and its value as HOME. It also identifies the parent type as Sales Order.

A successful response confirms that the endpoint accepted the dimension association. I would still open the intended Sales Order in Business Central and verify that the dimension appears on the correct record. An HTTP success alone does not prove the end-to-end mapping is right.

Important consideration: The parent identifier, dimension code, and dimension value must correspond to the intended record and valid Business Central configuration. The exact API endpoint and supported operations depend on the Business Central API version and the resource being used.

5. A Different Failure: Project Journal Document Numbers

Not every error comes from a sales order. Consider a second, separate example: an integration creates Project Journal lines for time or project cost. The project and task may exist, but a line can still fail because required journal information is absent or inconsistent.

Business Central documents and journal entries often require specific information before they can be processed.

For example, Project Journals contain information such as Line Type, Posting Date, Document No., Project No., Project Task No., and Type. Some fields are required depending on the document, journal configuration, and business process.

5.1 Compare the Incoming Line with a Valid Journal Line

Business Central Project Journals page showing journal lines and Document No. field.

Fig 5.1: Project Journals page showing project-related journal lines and the Document No. field.

The Document No. field is an important part of journal processing. It helps identify and track the transaction being recorded.

When creating journal lines through an API, it is necessary to understand whether the document number is expected to be provided by the request or generated through the applicable numbering configuration.

5.2 Trace the Document Number to Its Source

Document numbers are used to identify transactions throughout Business Central.

If a request contains an invalid document number, omits a required value, or does not follow the applicable numbering requirements, the operation may fail.

For this journal scenario, I would verify:

  1. Whether the document number is mandatory for the operation.
  2. Whether the number should be provided or generated automatically.
  3. Whether the relevant number series is configured.
  4. Whether the document number is valid for the journal or document being created.

A useful troubleshooting approach is to compare the API request with a record created manually through the Business Central interface. This can help identify which fields and values are required for the same business operation.

6. When the Payload Itself Is the Problem

Sometimes the investigation really does end in the payload. A field defined as a number cannot be fixed by changing posting setup, and an incorrectly formatted date cannot be repaired by creating a customer record.

A JSON request can be syntactically correct but still contain values that Business Central cannot process.

6.1 Common Data Type Issues

Expected Data TypeExample of Incorrect InputWhat to Check
IntegerEmpty string ("")Send a valid integer or handle an optional value correctly
DecimalIncorrect numeric representationCheck decimal serialization and API expectations
DateInvalid or empty date valueVerify the expected date format and optional-field handling
GUIDInvalid identifier formatConfirm that the identifier is a valid GUID
BooleanIncorrect text representationSend the expected Boolean value

6.2 Integer and Decimal Values

One common source of API errors is sending values in a format that does not match the expected field type.

For example, an integer field cannot accept an empty string as a valid integer. Similarly, decimal fields require the correct numeric representation.

For integrations that use JSON, it is important to understand how the source application serializes numeric values and how the destination API expects to receive them.

6.3 Date Formatting

Date values also need to be handled carefully. Different applications may represent dates differently, and an integration must ensure that the value sent to Business Central matches the expected API format.

When a date-related error occurs, check:

  1. Whether the date value is valid.
  2. Whether the correct format is being used.
  3. Whether the field allows an empty or null value.
  4. Whether the source application is sending a date or a date-time value.
Technical takeaway: Do not assume that a value is valid simply because it can be included in JSON. Always check the data type and requirements of the destination Business Central field.

7. The Seven-Step Checklist for the Next Failed Request

When the next request fails, I would work through this sequence. It keeps the investigation tied to one operation and gives the team a reproducible explanation, not just a payload that happens to work after several retries.

Step 1: Identify the failing request

Start by identifying the API endpoint and the operation being performed. Determine whether the request is creating, updating, or retrieving a record.

Step 2: Read the complete error message

Business Central API responses often provide information about the field or validation that caused the request to fail. Read the complete response rather than focusing only on the HTTP status code.

Step 3: Verify the request payload

Check whether all required fields are included, field names match the API definition, values use the correct data types, identifiers are valid, and optional fields are handled correctly.

Step 4: Check the Business Central configuration

If the request structure is correct, investigate the relevant Business Central setup. Depending on the transaction, this may include Customer Posting Groups, General Business Posting Groups, VAT Business Posting Groups, General Posting Setup, Number Series, and Dimensions and Dimension Values.

Step 5: Verify related records

Check whether the customer, item, project, resource, or other referenced record exists and is available for the operation. A valid identifier in the request does not necessarily mean that the corresponding record is available in the intended company or environment.

Step 6: Test the corrected request

After identifying the root cause, make the required correction and send the request again. Where possible, test with a small and controlled payload before retrying the complete integration process.

Step 7: Document the resolution

Record the error, its root cause, and the correction made. This is useful when the same issue occurs in another environment or when the integration needs to be maintained by another developer or consultant.

8. What This Changes in an Integration Design

These examples reveal a useful design lesson: catching an error after the request reaches Business Central is necessary, but many common failures can be prevented earlier by agreeing on mappings, master-data prerequisites and ownership of setup.

  1. Understand the destination structure: Review the Business Central API definition and understand the fields required for the operation.
  2. Validate data before sending it: Check mandatory fields, data types, identifiers, and formats in the source application.
  3. Understand posting configurations: Posting groups and posting setup are important dependencies for financial transactions.
  4. Maintain correct references: Ensure that customers, items, projects, dimensions, and other related records are correctly identified.
  5. Handle optional values carefully: Do not send empty strings to fields that expect integers, decimals, dates, or other specific types.
  6. Test with realistic scenarios: A request that works with one customer or document may fail with another because the underlying configurations differ.
  7. Maintain error logging: Capture the endpoint, request details, response message, and relevant record identifiers to simplify troubleshooting.
  8. Avoid changing payloads randomly: Identify the root cause before modifying the request. This helps prevent introducing additional issues while trying to resolve the original one.
Technical takeaway:

Troubleshooting Business Central APIs requires more than checking whether a request is correctly formatted. It requires understanding the relationship between API fields, master data, posting configurations, dimensions, and the business rules applied by Business Central.

9. Questions That Usually Come Up During Troubleshooting

1. Why does Business Central reject an API request even when the JSON is valid?

Valid JSON only confirms that the request follows JSON syntax. Business Central also validates field types, mandatory values, references, configurations, and business rules. A request can therefore be valid JSON but still fail during processing.

2. What are posting groups used for in Business Central?

Posting groups help determine the General Ledger accounts used when transactions are posted. They connect business records and transaction types with the relevant accounting configuration.

3. Can dimensions be assigned through Business Central APIs?

Yes. Supported Business Central API resources allow dimension information to be associated with records. The required identifiers, dimension codes, and values must match the intended record and configuration.

4. Why are document numbers important when creating journal entries?

Document numbers help identify and track transactions. Their generation and validation depend on the journal process and the relevant number series configuration.

5. How can I identify whether an API error is caused by data or configuration?

Start with the complete error response and identify the field or validation involved. Then verify the payload, field data type, referenced record, and relevant Business Central setup. Comparing the API-created record with a manually created example can also help isolate the issue.

6. What is the best way to troubleshoot recurring API errors?

Use structured error logging, validate data before sending it, verify master data dependencies, and document the root cause and resolution. This makes recurring issues easier to identify and prevents repeated troubleshooting of the same problem.

10. Conclusion: Find the Rule Behind the Error

Back to our fictional order: if the payload is structurally correct but the required posting setup is missing, rewriting the JSON is not the answer. The answer is to identify which Business Central rule is being enforced and correct the source data or setup that violates it.

The screenshots and examples show three distinct checks: posting groups tell Business Central where accounting entries belong; dimensions provide the reporting context; and Project Journal fields identify the transaction being processed. Each can cause a different failure, even if the API endpoint itself is reachable.

Understanding these dependencies makes troubleshooting more effective. Instead of repeatedly modifying a request, developers and consultants can investigate the underlying cause, whether it is an incorrect data type, a missing reference, an incomplete posting configuration, or a mandatory field that has not been populated.

Final takeaway:

A reliable Business Central integration is not just about successfully sending data. It is about ensuring that the data being sent is complete, correctly mapped, and compatible with the business processes and configurations of the destination system.

About the Author

Adelle DSouza

Trainee Consultant

Adelle D’Souza is a Trainee Consultant at CloudFronts Technologies, working with Microsoft Dynamics 365 Business Central, ERP integrations, and related Microsoft technologies.

Connect: LinkedIn


Share Story :

SEARCH BLOGS :

FOLLOW CLOUDFRONTS BLOG :


Categories

Secured By miniOrange