Auto-generating reference numbers ensures that every form submission or record created through a Power Pages portal has a unique identifier. This can be used for tracking, user communication, or internal referencing.
Common Use Cases
- Support ticketing systems
- Case management
- Order processing
- Registration systems
- Application tracking
Method 1: Using Power Automate
Step 1: User Submits Form
- A form on Power Pages submits data to a Dataverse table.
Step 2: Trigger a Power Automate Flow
- Trigger: “When a row is added” (Dataverse)
- The flow will:
- Get the record’s GUID or a timestamp.
- Optionally fetch the latest record number to increment.
- Concatenate values to create a unique reference number.
Step 3: Update the Record
- Action: “Update a row” in Dataverse
- Set a field like
Reference Number
to a value like:"TKT-" + formatDateTime(utcNow(),'yyyyMMdd') + "-" + substring(guid(),0,6)
Method 2: Using Plugin (for Advanced Control)
- Create a Dataverse Plugin on the Create event of the entity.
- Inside the plugin:
- Generate a custom string using GUID, prefix, or other logic.
- Assign it to the
Reference Number
field before the record is committed.
This is best used for high-performance systems where consistency and order are critical.
Method 3: Using Business Rules and JavaScript (Client-Side)
- Less secure since logic runs in the browser.
- Can pre-fill a field with part of a reference number (e.g., date prefix).
- Final number still best handled server-side to avoid duplicates.
Best Practices
- Make the field Read-Only in the form to avoid user editing.
- Ensure uniqueness using Dataverse constraints or plugins.
- Use prefixes to distinguish types (e.g., TKT-, REG-, ORD-).
- Store creation timestamp for traceability.
Example Output Formats
TKT-20250423-0012
REG-APR-2025-001
CASE-IRF-0000193
ORD-240423-XYZ123