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.
Before you begin
- Business Central online, with a user who can create purchase invoices and whose account the flow will use
- A Power Automate license that includes premium connectors (Business Central and SFTP - SSH are premium)
- An SFTP server Paige can reach, with a folder for this scan job
- A Paige scan job with an invoice document type whose fields include vendor number or name, invoice number, invoice date, due date, and total
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
In Paige, open Settings (the gear at the bottom of the left menu — administrators only), pick the scan job, and choose Export.
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.Click Test Connection. What you should see:
FTP connection successful!Connect —Connected to FTP Server!and a green Connected label.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.
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.
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.
Condition: File name ends with
.json. Steps 3–8 go in If yes.
Parse JSON on the trigger's File content, schema generated from a real
.json.
Dynamics 365 Business Central: Find one record (V3) (only if you match by name). Table name
vendors; filterdisplayNameeq the parsedVendor Name. Its outputnumberis the vendor number.
Dynamics 365 Business Central: Create record (V3). Table name
purchaseInvoices. Row:Field Value vendorNumberthe vendor number (from step 4, or Paige's field) invoiceDateformatDateTime(<Invoice Date>, 'yyyy-MM-dd')dueDateformatDateTime(<Due Date>, 'yyyy-MM-dd')vendorInvoiceNumberthe parsed Invoice NumberThe output includes the new invoice's
id.
Dynamics 365 Business Central: Create record (V3). Table name
purchaseInvoiceLines. Row:documentId= the invoiceidfrom step 5,lineType=Account,accountId= the G/L account's id (look it up once with Find one record (V3) onaccounts, or paste the id),description=Paige – <document type>,quantity=1,unitCost=float(replace(replace(<Total>, ',', ''), '$', '')).For itemized invoices, loop over the parsed
line_itemsrows with Apply to each and create one line per row.
SFTP - SSH: Get file content using path. Path: the folder plus the parsed
pdf_file.
Attach the PDF — two actions:
- Create record (V3), Table name
attachments. Row:parentId= the invoiceid,parentType=Purchase Invoice,fileName= the invoice number plus.pdf. The output includes the attachment'sid. - Update an image, file or document (V3). Path: pick
attachments/attachmentContentfrom the picker; pathParametersid= the attachmentid; body = the file content from step 7.
- Create record (V3), Table name
Save. What you should see: the flow checker reports no errors.
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
Process one invoice through the scan job in Paige, review it, and wait for the export.
Open the flow's 28-day run history. What you should see: one successful run, every Business Central action
201.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.
