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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Attachments in credit purchase memo

(7) ShareShare
ReportReport
Posted on by 31

Response from - purchaseCreditMemos?$expand=documentAttachments&$filter=documentAttachments/any()  gives this response and documentAttachments array seems to be empty for specific item

But in interface I can see that this item has documents attached as can be seen in screenshot from dynamics

Is this a right place where this attachment should be or I should use different endpoint?

I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,225 Most Valuable Professional on at
  • Suggested answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at
    Hi, hope the following helps as well.
    Dynamics 365 Business Central: Using OData V4 unbound action (Codeunit API?) to communicate and exchange data seamlessly
    How to automatically upload files from OneDrive to Business Central with Power Automate (No customization)
     
    Thanks.
    ZHU
  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    8,760 on at

    Hi

    Thanks for sharing the screenshot and endpoint details . You're using:

    purchaseCreditMemos?$expand=documentAttachments&$filter=documentAttachments/any()

    but the documentAttachments array is returning empty, even though attachments are visible in the UI. Here’s what’s likely happening:

    1. Attachment Scope and Entity Binding

    • The documentAttachments entity only returns attachments explicitly linked to the credit memo record
    • If the attachments were added to a related document (e.g., the original purchase invoice or vendor card), they won’t appear in this response
    • Use the documentId or sourceType fields to confirm where the attachment is actually stored

    2. Attachment Visibility in UI vs API

    • The UI aggregates attachments from multiple sources (e.g., vendor, invoice, memo), but the API only returns those tied to the current entity
    • Try querying the documentAttachments endpoint directly with a filter on sourceType = 'Purchase Credit Memo' and sourceId = [credit memo ID]

    3. Alternative Endpoints to Try
    If attachments were added via the document page or manually uploaded, consider these endpoints:

    http
    GET /documentAttachments?$filter=sourceId eq [creditMemoId] and sourceType eq 'Purchase Credit Memo'

    or

    http
    GET /vendors([vendorId])/documentAttachments

    depending on where the attachment was added.

    4. Confirm Attachment Method

    • If attachments were added via the FactBox or Drag-and-Drop, they may be stored in a different table or require a different API call
    • Use the Page Inspection tool to confirm the exact table and field used


    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

  • CU07070529-0 Profile Picture
    31 on at
    @Jeffrey Bulanadi you are right, it's FactBox. Is there a way to get that attached document?
     
    Image preview
  • Gerardo Rentería García Profile Picture
    25,225 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    /companies({companyId})/documentAttachments?$filter=parentId eq {purchaseCreditMemoId}

    Best Regards
    Gerardo

  • Suggested answer
    Sohail Ahmed Profile Picture
    11,148 Super User 2025 Season 2 on at

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans