Skip to main content

Notifications

Community site session details

Community site session details

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

Automatically upload files in invoice capture using power automate

(2) ShareShare
ReportReport
Posted on by 634
Hi Folk,
 
Can someone please let me know how to automatically upload files in the 'Received Files' section for invoices in Invoice Capture, without manually adding them, using a Power Automate flow under Manage Channels?
 
Thanks
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,107 Super User 2025 Season 1 on at
    Automatically upload files in invoice capture using power automate
    Here's a solution for your second requirement:

    Objective:
    Break a multi-page invoice PDF into individual pages using Power Automate, and:
    1. Extract the first page → Used for Invoice Capture processing.
    2. Attach the remaining pages → As supporting attachments to the Pending Invoice in Invoice Capture.

    🔧 Prerequisites:
    • Invoice Capture is active with Power Automate channel configured.
    • Access to a PDF manipulation connector/service (since Power Automate alone doesn’t split PDFs natively).
      • Recommended: Encodian, Plumsail, or Adobe PDF Services connector.

    🧩 Step-by-Step Solution:

    Step 1: Trigger Flow (e.g., SharePoint/Email)
    Trigger: When a file is created in a SharePoint folder or received via email

    Step 2: Split the PDF
    Use Encodian – Split PDF action (or your preferred PDF utility):
    • Action: Encodian – Split PDF
    • Input: PDF content (from the trigger)
    • Output: Array of individual pages (page 1, page 2, page 3, etc.)
    Free connectors don’t support this; Encodian has a free tier for testing.

    Step 3: Upload First Page to Invoice Capture
    Use an HTTP POST (similar to your previous flow) to send Page 1 as the main invoice:
    Example payload:
    json
    CopyEdit
    {
      "fileName": "Invoice_Main_Page.pdf",
      "fileContent": "<Base64 of Page 1>",
      "vendorNumber": "123456",
      "documentType": "Invoice"
    }
    This sends Page 1 to the 'Received Files' section for processing.

    Step 4: Upload Remaining Pages as Attachments
    Loop through the remaining pages (Page 2 to end) and attach to the corresponding Pending Invoice record.
    Here’s how:
    Option A – Attach via Power Automate and Invoice Capture API
    • After the invoice is processed, identify the pending invoice ID (you may need to query Invoice Capture or wait for completion).
    • Use the Invoice Capture/Finance & Operations API to upload the attachment to that record.
    This requires correlating the invoice (e.g., using vendor number + invoice number) and calling a D365 F&O endpoint like:
    bash
    CopyEdit
    POST /data/Attachments
    with attachment metadata and content.
    Option B – Use Invoice Capture “Supporting Document” Field (during Upload)
    Alternatively, if you can send supporting documents during the first upload (supported in some implementations), include extra pages in the payload.
    Some implementations allow a payload like:
    json
    CopyEdit
    {
      "mainDocument": "<Base64 Page 1>",
      "attachments": [
        { "fileName": "Page2.pdf", "fileContent": "<Base64>" },
        { "fileName": "Page3.pdf", "fileContent": "<Base64>" }
      ],
      ...
    }
    You'll need to confirm if your Invoice Capture channel supports multi-part uploads like this.

    🔁 Summary of Flow Structure:
    1. Trigger (e.g., SharePoint → PDF)
    2. Split PDF into pages
    3. Upload Page 1 to Invoice Capture for processing
    4. Upload Pages 2+ as attachments to the pending invoice

    📌 Notes:
    • Be sure to store a correlation ID (vendor, invoice number) to link the attachments correctly.
    • Monitor the Invoice Capture processing status if waiting for invoice record creation before attaching.
  • D365FO Avatar Profile Picture
    634 on at
    Automatically upload files in invoice capture using power automate
    Hi @Saif Ali Sabri Thank you for the response will try it 

    Could you please also let me know how can i break multiple pages pdf of invoice through power automate and attach those pages in pending invoices attachment automatically through invoice capture , the data of invoice is present in the first page only all other page should be used only for attachment in pending invoices. 
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,107 Super User 2025 Season 1 on at
    Automatically upload files in invoice capture using power automate
    To automatically upload files to the 'Received Files' section in Invoice Capture using Power Automate, follow this step-by-step solution. This allows you to automate the ingestion of invoice documents without manual intervention.

    Goal:

    Use Power Automate to push documents into Microsoft Dynamics 365 Invoice Capture via the Manage Channels feature.

    🔧 Prerequisites:

    • You must have Invoice Capture configured and active in your environment.
    • A channel created under Manage Channels in Invoice Capture (e.g., Email, SharePoint, or Power Automate channel).
    • Appropriate permissions to configure Power Automate and Invoice Capture.

    🧩 Solution Steps: Upload Files Automatically to "Received Files"

    Step 1: Set Up a Power Automate Channel in Invoice Capture

    1. Go to Invoice Capture > Manage Channels.
    2. Select + New Channel.
    3. Choose Power Automate as the channel type.
    4. Provide a name (e.g., “AP Invoices Upload”).
    5. Save the channel. The system will provide a Power Automate flow template URL or schema (usually a webhook endpoint and payload structure).

    Step 2: Create a Power Automate Flow

    1. Go to Power Automate.
    2. Create a new automated cloud flow (triggered by SharePoint, OneDrive, Outlook, etc.).
    Example trigger: When a file is created in a SharePoint folder.

    Step 3: Add HTTP Action to Upload to Invoice Capture

    1. Add an HTTP action in your flow:
      • Method: POST
      • URL: Use the endpoint provided in your Power Automate channel in Invoice Capture.
      • Headers:
        • Content-Type: application/json
        • Ocp-Apim-Subscription-Key: (if required for authentication)
      • Body (Example Payload):
    json 
    {
      "fileName": "@{triggerOutputs()?['headers']['x-ms-file-last-modified']}",
      "fileContent": "@{base64(triggerOutputs()?['body']['$content'])}",
      "vendorNumber": "123456",  // Optional metadata
      "documentType": "Invoice"
    }
      • Ensure fileContent is base64-encoded.
    You may need to use ‘Get file content’ from SharePoint before encoding and sending it.

    Step 4: Test the Flow

    • Drop a file into the trigger location (e.g., SharePoint folder).
    • The flow should POST it to the Invoice Capture endpoint.
    • Go to Invoice Capture > Received Files, and confirm that the file appears.

    📌 Notes:

    • You can add dynamic fields like vendor name, invoice number, etc., in the payload.
    • Ensure your document follows the required format (PDF, TIFF, etc.).
    • You may handle retries or logging in case of errors.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 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…

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

#1
Martin Dráb Profile Picture

Martin Dráb 510 Most Valuable Professional

#2
Saalim Ansari Profile Picture

Saalim Ansari 315

#3
Adis Profile Picture

Adis 312 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans