Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Cannot read own created entity in D365FO

(1) ShareShare
ReportReport
Posted on by 63
I was creating my own entity in D365FO. It is an addition to the existing ECO entities managing files. I will post the metadata of my entitiy as an attachment.

When working with the entity in postman. I successfully managed to create an entity using a POST request. I was also able to fetch data (All entities, filtered entities). But when it comes to reading one entity (specified by its keys) I won´t be able to do so. 

This is my request:
{{d365_url}}/data/ChangeOrderProductDocumentAttachments(dataAreaId='demf',EngineeringChangeOrderNumber='000010',EngineeringChangeOrderProductItemId='F00001',DocumentAttachmentTypeCode='File',AttachmentDescription='FileDescription',AttachedDateTime=2025-03-18T13:40:10Z)
 
This is the result:
400 Bad Request
HTTP Error 400. The request URL is invalid.
 
I was using all the keys specified in the entity. If I drop any of the keys the ressource can not be found:
404 Not Found
{
    "Message": "No HTTP resource was found that matches the request URI 'https://cf-demo39616182e12858fd6devaos.axcloud.dynamics.com/data/ChangeOrderProductDocumentAttachments(EngineeringChangeOrderNumber='000010',EngineeringChangeOrderProductItemId='F00001',DocumentAttachmentTypeCode='File',AttachmentDescription='WindchillSoftwareMatrices_12_0_2_0',AttachedDateTime=2025-03-18T13:40:10Z)'. No route data was found for this request."
}
 
Am I doing something completly wrong? The EventViewer was not helpful at all. Online ressources neither. 
I appreciate any help! 
Categories:
  • André Arnaud de Calavon Profile Picture
    294,777 Super User 2025 Season 1 on at
    Cannot read own created entity in D365FO
    Hi,
     
    Can you tell where exactly you make this request? Are you doing this e.g. in a browser or Power Automate?
    Do you get a list of records when you use the custom entity without specifying the key field values?
     
    In case you used the URL in a browser, did you first create a Dynamics 365 F&O session using the F&O URL without /data/...?
    If it works without key fields, check all field names for proper casing. OData is case sensitive.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    16,335 Super User 2025 Season 1 on at
  • CH-11120820-0 Profile Picture
    63 on at
    Cannot read own created entity in D365FO
    Hello Holly, 

    I want to reply to each of your suggestions.
     
    1. I confirmed that the AttachedDateTime is encoded properly. I tried another request with "AttachedDateTime" it worked like a charm. Removing it won´t be possible. Since it is a needed value (key).
    2. There are no special chars in my used AttachmentDescription.  
    3. As you can see in the initial post, I am using /data/, so I assume I am using the latest API version.
    4. As I mentioned in the initial post, I was already successful by fetching the data using just a filter. However this won´t help because just reading is not enough for me. I need to also update or delete those values. I double checked the metadata and I can see that the entity is public because I can fetch data using $filter or create an entity with POST.
  • Suggested answer
    Holly Huffman Profile Picture
    6,078 on at
    Cannot read own created entity in D365FO
    Good morning, afternoon, or evening depending on your location!
     
    Your entity definition confirms that you are using the correct set of primary keys: dataAreaId, EngineeringChangeOrderNumber, EngineeringChangeOrderProductItemId, DocumentAttachmentTypeCode, AttachmentDescription, and AttachedDateTime.

    Possible Reasons for the 400 Bad Request Error
    1. Date-Time Format Issue:
      • The AttachedDateTime key is of type Edm.DateTimeOffset. Try encoding it properly:
        AttachedDateTime=2025-03-18T13%3A40%3A10Z
      • Alternatively, try removing it temporarily to see if the request succeeds.
    2. Data Encoding Problems:
      • If your AttachmentDescription contains special characters (like spaces), encode them properly:
        AttachmentDescription='FileDescription'
      • Ensure the encoding matches OData query standards.
    3. Incorrect Routing or API Version:
      • Verify that the OData endpoint is using the latest version (/data/ or /data/v9.0/ for example).
    4. Debugging Steps:
      • Test with $filter to retrieve just one entity instead of direct lookup:
        {{d365_url}}/data/ChangeOrderProductDocumentAttachments?$filter=EngineeringChangeOrderNumber eq '000010'
      • Check your entity metadata using:
        {{d365_url}}/data/$metadata
      • If possible, confirm that the entity has proper permissions assigned.
     
    Please note: I teamed up with CoPilot AI to research and craft the best response to your question!
    Hope this helps some!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
Martin Dráb Profile Picture

Martin Dráb 353 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 276

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 190 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans