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, ...
Unanswered

Data Retrieval Issue When Creating a New Customer in Dynamics 365 F&O

(0) ShareShare
ReportReport
Posted on by 5

The Problem:

When creating a new customer in Dynamics 365 Finance and Operations, the Inserted event on the CustTable table is triggered. This event calls code that retrieves customer data (phone number, email address, fax number, address) and sends it to an external CRM system.

Current Behavior:

  • In the case of creating a new customer, the additional data (phone, email, fax, address) arrives empty in the CRM system.

  • In the case of updating an existing customer, all data arrives correct and complete in the CRM system.


I tried it : I attempted to resolve the issue by adding a delay (using the sleep() function) before executing the data retrieval code, but this approach did not work, and the contact data (phone, email, fax, address) still arrived empty when creating a new customer.

The Question:

Why do contact data (phone, email, fax) and address data arrive empty when creating a new customer, but arrive correctly when updating an existing customer, even though the same data retrieval code is used in both cases?

 

Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    239,880 Most Valuable Professional on at
    You can't expect strangers on internet to identify where your solution fails, especially if you don't share information about the design of your solution. Instead, you'll need to do some work on the problem isolation, because knowing just that the final result isn't correct clearly doesn't tell you what to fix.
     
    If I was you, I'd first check the places where the data leaves F&O and where it enters the other system. This will tell you where to look for the problem. If wrong data is sent, you need to check your logic preparing the data in F&O (and you can ignore the whole CRM and the communication with it, because the problem doesn't lie there). Similarly, if you know that you receive correct data in the CMR but it's not persisted correctly, you can take F&O and the communication out of question, because the problem is somewhere in F&O. And if you found that the data is sent correctly but didn't reach CRM, you'd need to check the communication channel in between.
  • CU20040728-0 Profile Picture
    5 on at

    Thank you for your input, but I believe you may have misunderstood the nature of my question.

    I have already done the problem isolation you suggested. Let me clarify:

    What I already know:

    1. The issue is isolated to the data preparation logic inside F&O, not the communication channel or the external CRM system.

    2. The data retrieval code works perfectly because it returns complete data when the customer is updated.

    3. The same code returns empty data when the customer is first created.

    My specific question was:

    Why does the same data retrieval logic return empty data on the Inserted event but complete data on the Updated event?

    The answer (which I have already identified):

    • The DataEventType::Inserted event fires immediately after the CustTable record is saved.

    • However, related data (phone, email, fax, address) is stored in child tables (LogisticsElectronicAddress, DirPartyLocation) after the main record is saved.

    • Therefore, when the Inserted event fires, this related data is not yet available in the database.

    • On the Updated event, all related data already exists, so it is retrieved successfully.

    My attempt to solve it:

    I tried adding a sleep() delay before executing the data retrieval code on the Inserted event, but this did not work because the data is not saved within a predictable timeframe.

    My question to the community was never "where is the problem?" — I already know where it is. My question was:

    "Is there a reliable, event-driven way (other than using Updated only) to ensure that related customer data (phone, email, address) is fully saved before triggering the external integration?"

    What I am looking for:

    A solution that guarantees that all related data is persisted before the integration code runs â€” without relying on arbitrary delays or removing the Inserted event entirely.

    I hope this clarifies my original question. Thank you.

  • Martin Dráb Profile Picture
    239,880 Most Valuable Professional on at
    You claim that "my question to the community was never "where is the problem?" — I already know where it is", but if you read your original question, you'll see that you forgot to share this information with us. You said that "the additional data [...] arrives empty in the CRM system", not that you already knew that you produce wrong data in F&O and there is no point checking whether the data appears in CRM. Please provide more information next time, so we can talk about your actual problem from the beginning.
     
    Okay, so you already know that the bug is in your code in F&O and you want us to help you fixing it. Then please tell us what code you've written.
     
    It seems that you try to send the data from an event handlers for Inserted and Updated events of CustTable. If so, it's a wrong design with many critical problems.
     
    For example, that the record was inserted doesn't mean that the transaction will be committed. If you send data that won't actually be committed in F&O, you'll create ghost data in CRM that never actually happened in F&O.
     
    Another bug is that the communication slow down all inserts and updates of customers, and if the communication has a problem, it'll block all such changes in F&O.
     
    And as you've already found, you need table than just CustTable, therefore looking just at inserts and updates of CustTable isn't sufficient. For example, if you change a customer address, it's not a change of CustTable and your code will ignore it.
     
    It should be now obvious that calling sleep() can't resolve any of these bugs in the architecture.
     
    Please confirm your current design and tell us what additional data you're interested in. Just the primary postal and electronic addresses?
  • CU20040728-0 Profile Picture
    5 on at
     
    Thank you so much, sir/. I am honored to learn from you. I have attached the code and instructions on how to call it... I would appreciate any help if possible.
     
     
    First, call the Send_To_CRM_Organization class in the CustomTableEventHandler code.

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
Subra Profile Picture

Subra 500

#2
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 461 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans