web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Data entity import doesn’t Change Company per DataArea = Primary Company Context

(2) ShareShare
ReportReport
Posted on by 22

Hi everyone,

I’m trying to create a custom data entity for BankReconciliationMatchRule_PostingInfo.

On the entity, I set Primary company context to DataArea which i got from a join with the CompanyInfo DataSource using the Exisiting table relation.

Issue: when I import a file containing rows for multiple legal entities, the import process seems to stay “stuck” in the current legal entity of the Data management import project. Because of that, company‑specific fields like Tax group / Tax item group are validated against the project’s current company, not the company specified in the row. (Error below) 

Do i extend the mapEntityToDataSource method and ChangeCompany Each time?

BankReconciliationMatchRule_PostingInfo Entity.png
Error While Import.png
Categories:
I have the same question (0)
  • Suggested answer
    Assisted by AI
    ANInnoSolutions Profile Picture
    534 on at
    Hi DO-21010822-0,
     
    1) Issue
    - Data entity import in D365 Finance does not switch company context based on DataArea field
    - Import process remains in the legal entity defined in the Data Management project
    - Records for multiple companies are not processed in their respective legal entities
    - Company-specific validations such as Tax group or Tax item group fail due to wrong company context
    - Setting Primary Company Context to DataArea in the entity does not resolve the issue
     
    2) Reason
    - The issue is caused by the Data Management Framework processing records using the execution context of the import project rather than dynamically switching per row
    - The Primary Company Context property only defines the main company field but does not automatically enforce runtime context switching during import
    - As a result validations and lookups are executed against the current company instead of the company specified in each record
    - This leads to failures when data such as tax configuration differs across legal entities
    - This can happen because standard entity processing does not invoke changeCompany automatically unless explicitly implemented in the data source mapping logic
     
    3) Resolution
    - Extend the mapEntityToDataSource method to implement explicit changeCompany logic per record
    - Use changeCompany(DataAreaId) to switch context based on the value from the incoming row before performing data operations
    - Ensure that all company-specific validations and assignments are executed within the correct company scope
    - Validate that the DataArea field is correctly mapped and populated in the entity staging data
    - Avoid relying solely on Primary Company Context as it does not enforce execution context switching
    - Test the solution with multiple legal entities to confirm that validation and posting occur in the correct company
    - Alternatively consider splitting import files per legal entity if customization is not desired
    - Review standard Microsoft entities with cross-company behavior as reference implementations
     
    For a more detailed answer, please provide more information.
     

    Rg,

    Alexander

    *Due to the complex and different possibilities of deploying Dynamics 365 I highly recommend not to setup the application without some expert/partner or support. (For more information contact me under anassl@inno-solutions.info or visit www.inno-solutions.de)

    *The Information comes directly from the manufacturer or provider and are validated (not guaranteed) up to date of creation of the posting.

    References:

    1. Microsoft Licensing Guide
    2. Microsoft Doc`s/Learn

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 461 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 428

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans