Prefill form using form data model

Last update: 2024-01-25
  • Created for:
  • Intermediate

You will learn to use form data model’s request attribute to fetch data to populate adaptive form.
On completion of this course you will have learned the following.

  • Create RDBMS backed Form Data Model
  • Create Association between 2 entities
  • Populate table with data returned by get service of Form Data Model
  • Use Form Data Model’s request attribute

The following video gives you an overview of the course


Hi, in this course, you will learn how to use a request attribute in a form data model. The form you see on the screen is based on a form data model which expects a request attribute called employee Id.

As you can see in the URL, there’s a request attribute called employee ID and its value is set to 208. So, when you will load this form, the employee ID’s value 208 is passed to the underlying form data model. The form data model will then go and fetch the data associated with employee ID 208 from its underlying data source. And the data returned by the form data models Get Service is then used to populate this particular form here. So, if I were to change the employee ID to 207, I would get a different set of data. So, now let’s take a look at the underlying form data model that was used to build this particular form.

As you can see, the form data model has two entities. One is a new hire entity and then other entities the beneficiaries entity. Every new hire can have one or more beneficiaries. And that association is defined here, called Get Beneficiaries. And it’s one to many association between a new hire and the beneficiaries. Let’s take a look at the Get Operation of the new hire. So, I selected the new hire entities. Click on the Edit Properties, and there’s a Read Service called Get Service, and we need to specify the arguments that are required. So, the argument here is employee ID and it is bound to request attribute and the binding value is called employee Id. So, what this means is the form data model requests a value for this request attribute called employee Id. So, if you go back to our form, you would notice that there is an employee ID in this URL when the form is rendered. We need to take the value of this employee Id and pass it on to our underlying form data model to fetch the data associated with the appropriate employee Id. So, by end of this course, you will learn how to create a form data model which is based on a database, how to create associations between two entities, how to pass the value in the request attribute of the form URL to the underlying form data model, and how to bind the data that is returned from the form data model with the appropriate fields in your adaptive form. -


  • Working instance of AEM Forms
  • Familiar with MySQL database and MySQL workbench
  • Some experience in creating Adaptive Forms

Next Steps

Create Database Tables

On this page