Configuring Prefill Service in Adaptive Forms using Edge Delivery Services
Form prefilling is the process of automatically populating form fields with relevant data from external sources as soon as a user opens the form. By leveraging information from user profiles, databases, saved drafts, or other backend systems, prefilling streamlines the form-filling experience—reducing manual input, minimizing errors, and accelerating completion. This not only enhances user satisfaction but also increases the likelihood of successful form submissions.
Benefits of Form Prefilling
How Prefilling Works
The following diagram illustrates the automatic prefill process that occurs when a user opens an Adaptive Form:
The prefill process involves four key steps:
- User Opens Form: User accesses an Adaptive Form through a URL or navigation
- Identify Data Source: Prefill service determines the configured data source (Form Data Model or Draft service)
- Retrieve Data: System fetches relevant user data based on context, parameters, or user identification
- Map and Display: Data is mapped to form fields using
bindRef
properties and the populated form is displayed to the user
This automated process ensures users see a form pre-populated with their relevant information, significantly improving the user experience and form completion rates.
Data Structure for Prefilling
Adaptive Forms support two types of fields:
- Bound fields: Fields connected to a data source with a non-empty
bindRef
property - Unbound fields: Standalone fields with empty
bindRef
values
The prefill data structure includes:
- afBoundData: Contains data for bound fields and panels
- afUnBoundData: Contains data for unbound fields
The data format must match your form model:
- XFA forms: XML compliant with XFA template schema
- XML schema forms: XML matching the schema structure
- JSON schema forms: JSON compliant with the schema
- Form Data Model (FDM) forms: JSON matching the FDM structure
- Schema-less forms: All fields are unbound and use unbound XML
Prerequisites
Before configuring prefill services, ensure you have:
Required Setup
Access Requirements
- Access to AEM Forms as a Cloud Service
- Permissions to create and edit forms
- Universal Editor access with required extensions enabled
Prefill Service Options
The Universal Editor provides two prefill service options:
Detailed Comparison
Configure Prefill Service for a Form
Step 1: Create Form Data Model
-
Log in to your AEM Forms as a Cloud Service instance
-
Navigate to ۶Ƶ Experience Manager > Forms > Data Integrations
-
Select Create > Form Data Model
-
Choose your Data Source Configuration and select the configured Data Source
note tip TIP For detailed instructions on creating Form Data Models, see Create Form Data Model.
Step 2: Configure FDM Services
-
Go to ۶Ƶ Experience Manager > Forms > Data Integrations
-
Open your Form Data Model in edit mode
-
Select a data model object and click Edit Properties
-
Configure Read and Write services for the selected data model objects
-
Configure service arguments:
- Click the edit icon for the read service argument
- Bind the argument to a User Profile Attribute, Request Attribute, or Literal value
- Specify the binding value (e.g.,
petid
for a pet registration form)
-
Click Done to save the argument and Save to save the FDM
note note NOTE Learn more about configuring FDM services in Work with Form Data Model (FDM).
Step 3: Create an Adaptive Form
-
Navigate to ۶Ƶ Experience Manager > Forms > Forms & Documents
-
Select Create > Adaptive Forms
-
In the Source tab, select an Edge Delivery Services template:
-
Click Create to open the Create Form wizard
-
Specify the form details:
- Name: Enter a descriptive name for your form
- Title: Provide a user-friendly title
- GitHub URL: Enter your repository URL (e.g.,
https://github.com/wkndforms/edsforms
)
-
Click Create
The form opens in the Universal Editor for authoring.
Step 4: Configure Form Data Source
-
Select your form and click Properties
-
Open the Form Model tab
-
From the Select From dropdown, choose Form Data Model (FDM)
-
Select your created Form Data Model (e.g., PetFDM) from the dropdown
-
Click Save & Close
-
Open the form for editing in Universal Editor
The form elements from your FDM appear in the Datasource tab of the Content Browser.
Step 5: Add Data Binding to Form Fields
-
Select data elements from the Datasource tab
-
Click Add or drag-and-drop elements to build your form
-
Add data binding to form fields:
-
Select a form field
-
In the Properties panel, find the Bind Reference property
-
Select the appropriate data binding reference
-
Step 6: Enable Required Extensions
Ensure these extensions are enabled in Universal Editor:
-
AEM Form Properties Extension
- Open Extension Manager in Universal Editor
- Enable the AEM Form Properties extension
-
Data Source Extension
- Enable the Data source extension if you don’t see the Data Sources icon
note tip TIP For detailed instructions on managing extensions, see .
Step 7: Configure Prefill Service
-
Open your Adaptive Form in Universal Editor
-
Click the AEM Form Properties extension icon
-
Click the Prefill tab
-
Select Form Data Model Prefill Service
-
Click Save & Close
Step 8: Preview and Test
-
Go to Forms > Forms and Documents
-
Select your Adaptive Form
-
Choose Preview as HTML
-
Test prefilling by appending parameters to the URL:
https://your-preview-url.com?
<bindreferencefield>
=<value>
Example:
https://your-preview-url.com?petid=12345
The form should automatically populate with data based on the provided parameter.
Examples
Sample Prefill Data Structures
JSON Example for FDM-based Form:
{
"afBoundData": {
"user": {
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "+1-555-0123"
}
},
"afUnBoundData": {
"additionalInfo": "User preferences loaded"
}
}
XML Example for XFA-based Form:
<?xml version="1.0" encoding="UTF-8"?>
<afData>
<afBoundData>
<user>
<firstName>John</firstName>
<lastName>Doe</lastName>
<email>john.doe@example.com</email>
</user>
</afBoundData>
</afData>
Example Prefill URLs
The URLs below are for illustration purposes only and will not work as-is. Replace the host and parameters with those relevant to your own environment when testing prefill functionality.
Basic prefill test:
https://preview.example.com/form.html?userId=12345
Multiple parameter test:
https://preview.example.com/form.html?userId=12345&category=premium
Troubleshooting
table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 5-row-3 | ||
---|---|---|
Issue | Possible Cause | Solution |
Form fields not prefilling | Incorrect bindRef values |
Verify bindRef matches FDM field names exactly |
Data format errors | Mismatched data structure | Ensure prefill data matches form model schema |
Service not found | FDM configuration issues | Check FDM services are properly configured and saved |
Authentication errors | Data source connectivity | Verify data source credentials and connectivity |
Partial data loading | Missing field mappings | Ensure all required fields have proper data bindings |
-
Verify FDM Configuration:
- Check if services are configured correctly
- Test FDM services independently
- Validate data source connectivity
-
Check Form Configuration:
- Confirm form is associated with correct FDM
- Verify field
bindRef
values - Test form without prefill first
-
Test Data Flow:
- Use browser developer tools to inspect network requests
- Check console for JavaScript errors
- Validate response data format
-
Common Error Messages:
- “Prefill service not found”: Check service configuration
- “Data binding failed”: Verify
bindRef
accuracy - “Invalid data format”: Ensure data matches schema
Best Practices
- Use descriptive naming: Name your FDMs and services clearly
- Validate data schemas: Ensure data structure matches form requirements
- Test incrementally: Configure and test one field at a time
- Document mappings: Keep track of field-to-data mappings
- Minimize data volume: Only prefill necessary fields
- Use caching: Configure appropriate caching for frequently accessed data
- Optimize queries: Ensure database queries are efficient
- Monitor performance: Track form load times with prefill enabled
- Validate input parameters: Always validate URL parameters
- Sanitize data: Clean data before prefilling forms
- Implement access controls: Ensure users can only access their own data
- Use HTTPS: Always use secure connections for data transmission
- Provide feedback: Show loading indicators during data fetch
- Handle errors gracefully: Display helpful error messages
- Allow overrides: Let users modify prefilled data
- Maintain consistency: Use consistent prefill behavior across forms
Frequently Asked Questions
?<bindreferencefield>=<value>
. Ensure the field has a valid bindRef
that matches your data structure. Use browser developer tools to inspect network requests and verify data is being fetched correctly.Adaptive Forms support multiple formats depending on your form model:
- XFA forms: XML matching the XFA schema
- JSON schema forms: JSON data compliant with the schema
- FDM forms: JSON that maps to the data model structure
- XML schema forms: XML matching the schema structure
afBoundData
section and must match your form model schema. Unbound fields use the afUnBoundData
section and can contain any additional data.bindRef
values that match your FDM exactly. Verify that your data source contains all the required fields and that the data structure matches your form model schema.