Power Automate28 March 20267 min readFounder

Power Automate PDF Generation: 5 Patterns That Scale

Move beyond basic PDF attachments. These five Power Automate flow patterns cover batch generation, conditional layouts, audit trails, and SharePoint delivery at enterprise scale.

Most teams start with a simple "generate and email" flow. That works fine until your volume grows, your templates become conditional, or compliance requires an audit trail. Here are five patterns we've seen succeed in production.

Pattern 1: Batch Generation with Concurrency Control

When you need to generate hundreds of PDFs in a single flow run, wrap your REFRACT PDF call in an Apply to Each loop with concurrency set to 5. This avoids throttling while keeping run time low.

- Apply to each (concurrency: 5):
    Input: triggerBody()?['records']
    Actions:
      - REFRACT PDF: Generate PDF
      - SharePoint: Create File

Tip: Always store the generation timestamp and template version alongside the file. You'll thank yourself during audit season.

Pattern 2: Conditional Layouts via Dynamic Template IDs

Instead of one mega-template with complex conditional visibility logic, maintain separate slim templates and select the right one at flow runtime.

templateId: if(equals(triggerBody()?['type'], 'invoice'), 'invoice-v2', 'receipt-v1')

This keeps templates readable, allows independent versioning, and makes rollbacks trivial.

Pattern 3: Audit Trail with Dataverse

Every PDF generation event should write a record to a REFRACT PDF Audit Log Dataverse table before the file is stored. This gives you:

  • Who triggered the generation
  • Which template and version was used
  • The exact timestamp and request payload hash
{
  "vaultpdf_template_id": "invoice-v2",
  "vaultpdf_triggered_by": "[email protected]",
  "vaultpdf_payload_hash": "sha256:abc123...",
  "vaultpdf_generated_at": "2026-03-28T14:32:00Z"
}

Pattern 4: SharePoint Delivery with Version History

Use structured SharePoint library paths to keep file history clean:

/PDFs/{Year}/{Month}/{AccountName}/{DocumentType}_{Timestamp}.pdf

Enable SharePoint's built-in versioning on the library. Combined with your Dataverse audit log, you have a provenance chain that supports compliance reviews.

Pattern 5: Error Handling and Retry

Wrap REFRACT PDF calls in a Scope action and add a Run After error handler that:

  1. Logs the failure to Dataverse
  2. Sends an adaptive card to a Teams channel
  3. Appends the failed record to a retry queue table
Configure run after: Has Failed, Timed Out

Production flows fail. The difference between a support ticket and a silent recovery is a well-designed error path.

Wrapping Up

These patterns are composable — you can combine batch generation with audit trails and SharePoint delivery in a single flow. Browse the REFRACT PDF integration guide for the full payload reference.