# Create Business Central purchase invoices from Paige with Power Automate

Build the Power Automate flow that watches Paige's SFTP export folder, reads each invoice's field values, creates a draft purchase invoice in Dynamics 365 Business Central with a line at the total, and attaches the PDF — all with Microsoft's Business Central connector.

Product: paige · Audience: system-administrator · Time: 1.5 hours · Last verified: 2026-09-05

Canonical: https://help.ademero.com/paige/integrations/create-business-central-purchase-invoices-from-paige-with-power-automate

**At the end of this guide, every invoice Paige finishes becomes a draft purchase invoice in Business Central within minutes — vendor set, dates and vendor invoice number filled, a G/L line at the total, and the PDF attached as an incoming document — with no data entry.**

The flow is: *SFTP trigger → keep only the data file → Parse JSON → create the invoice → add the line → get the PDF → create the attachment record → upload its content.* It uses the **Dynamics 365 Business Central** connector's **Create record (V3)** and **Update an image, file or document (V3)** actions against the standard `v2.0` API.

## Step 1 — Point Paige at your SFTP server

1. In Paige, open **Settings** (the gear at the bottom of the left menu — administrators only), pick the scan job, and choose **Export**.
2. Click the **FTP** card. Enter the **FTP Address**, **Port** `22`, **Username**, **Password**, and in **FTP Folder Path** a folder for this scan job, such as `/paige/invoices`.
3. Click **Test Connection**. **What you should see:** `FTP connection successful!` Connect — `Connected to FTP Server!` and a green **Connected** label.
4. Turn on **Enable Auto Export**. Under **Auto Export Settings**, pick your invoice type under **Document Types**, set **Auto Field Entry Complete** to **Yes**, and set **Human Reviewed** to **Reviewed**. Click **Save**.

Open port 22 on your firewall to Paige's address ranges — [Outbound IP ranges for firewall allow-lists](/paige/document-processing/outbound-ip-ranges-for-firewall-allow-lists).

## Step 2 — Decide how the vendor is identified

Business Central's API takes either `vendorNumber` (the vendor's No.) or `vendorId`. The reliable choice is the **vendor number**. Give the Paige invoice type a `Vendor Number` field if your invoices carry your vendor code, or have the reviewer set it; otherwise the flow looks the vendor up by name with **Find one record (V3)** on the `vendors` table, which works when the invoice's spelling matches the vendor card exactly.

## Step 3 — Build the flow

Create an **Automated cloud flow**. In every Business Central action, set **Environment** to yours, **Company** to yours, and **API category** to `v2.0`.

1. **Trigger — SFTP - SSH: When a file is added or modified.** Connection: **Host server address**, **User name**, **Password**, **Port number** `22`. **Folder:** the scan job's folder. **Include file content** on.

2. **Condition:** *File name* **ends with** `.json`. Steps 3–8 go in **If yes**.

3. **Parse JSON** on the trigger's *File content*, schema generated from a real `.json`.

4. **Dynamics 365 Business Central: Find one record (V3)** (only if you match by name). **Table name** `vendors`; filter `displayName` **eq** the parsed `Vendor Name`. Its output `number` is the vendor number.

5. **Dynamics 365 Business Central: Create record (V3).** **Table name** `purchaseInvoices`. Row:
   
   | Field | Value |
   |---|---|
   | `vendorNumber` | the vendor number (from step 4, or Paige's field) |
   | `invoiceDate` | `formatDateTime(<Invoice Date>, 'yyyy-MM-dd')` |
   | `dueDate` | `formatDateTime(<Due Date>, 'yyyy-MM-dd')` |
   | `vendorInvoiceNumber` | the parsed `Invoice Number` |
   
   The output includes the new invoice's `id`.

6. **Dynamics 365 Business Central: Create record (V3).** **Table name** `purchaseInvoiceLines`. Row: `documentId` = the invoice `id` from step 5, `lineType` = `Account`, `accountId` = the G/L account's id (look it up once with **Find one record (V3)** on `accounts`, or paste the id), `description` = `Paige – <document type>`, `quantity` = `1`, `unitCost` = `float(replace(replace(<Total>, ',', ''), '$', ''))`.
   
   For itemized invoices, loop over the parsed `line_items` rows with **Apply to each** and create one line per row.

7. **SFTP - SSH: Get file content using path.** Path: the folder plus the parsed `pdf_file`.

8. **Attach the PDF** — two actions:
   - **Create record (V3)**, **Table name** `attachments`. Row: `parentId` = the invoice `id`, `parentType` = `Purchase Invoice`, `fileName` = the invoice number plus `.pdf`. The output includes the attachment's `id`.
   - **Update an image, file or document (V3)**. **Path:** pick `attachments/attachmentContent` from the picker; **pathParameters** `id` = the attachment `id`; body = the file content from step 7.

9. **Save.** **What you should see:** the flow checker reports no errors.

> **NOTE:** Business Central's connector caps a record at 8 MB. Invoice PDFs are usually well under that; for scanned documents that aren't, downscale in Paige's scan job settings or attach only the first pages.

## Step 4 — Test it

1. Process one invoice through the scan job in Paige, review it, and wait for the export.
2. Open the flow's **28-day run history**. **What you should see:** one successful run, every Business Central action `201`.
3. In Business Central, open **Purchase Invoices**. **What you should see:** the draft invoice with the vendor, dates, vendor invoice number, and the line at the total; the PDF under **Attachments** in the FactBox. Post it as you normally would.

## When it doesn't work

| Symptom | Where to look |
| --- | --- |
| The flow never runs | Wrong SFTP folder, or a subfolder. Files over 50 MB are skipped by this trigger. |
| Runs four times per invoice | The `.json` condition is missing. |
| Create record fails on the vendor | No vendor with that number, or the name lookup found nothing. Correct the vendor field in Paige during review. |
| Create record fails on a date | Use `formatDateTime(..., 'yyyy-MM-dd')`; Paige exports dates as printed. |
| Line fails on `accountId` | It's the account's GUID `id`, not its number. Look it up once. |
| Attachment record created but empty | The content update targeted the wrong `id`, or the body wasn't the raw file content. |
| Nothing arrives from Paige | Auto-export criteria aren't met, or the invoice was processed before you enabled auto export. Export once from the **Documents** page with **Export** and tick **FTP**. |

If the Paige side is the problem, contact Ademero support with the scan job name and the message from **Test Connection**.

## What's next

- [Connect Paige to Dynamics 365 Business Central](https://help.ademero.com/paige/integrations/connect-paige-to-dynamics-365-business-central)
- [Write extraction guidance the AI can follow](https://help.ademero.com/paige/document-processing/write-extraction-guidance-the-ai-can-follow)
