Skip to main content
Mitratech Success Center

Populating a dropdown control from a database

Here's how to populate Dropdown Control from a Database.

The sample project imports an Excel spreadsheet into a database to populate this dropdown control. There is an Excel spreadsheet named ChargeNumbers.xlsx in the sample project. You can check out and edit this spreadsheet, and when you upload it, it will automatically be imported into the database. The import is done via a Database Connector in the sample project, which is named “ERP Import”. We aren’t going to dive into that particular process for this walk-through, but you should know that this is the source of the database values, in case you want to experiment with it later

To pull the data from the database to fill a dropdown control, we will have to invoke a Custom Task from the form. Click on the picker control’s Build button that is located right next to the Add Custom Task button to open the Choose Custom Task dialog box. We will choose the custom task from this dialog box, by selecting Database Connectors >> Fill Dropdown from DB.


The picker textbox should now display the text, "Fill Dropdown from DB". Click the Add Custom Task button to add the custom task as a form event.

From the Event Name dropdown, select “[View State Init]”, which is the event that is fired when the form is opened. Now click the Configure button to configure which control will be filled from the database.


Clicking on the Configure button will open the Fill Dropdown From DB configuration dialog box. We are going to use the ERP Import database connection to provide the data for the dropdown control, so select “Excel Import” from the DB Connection dropdown. Click the Connect button below the DB Connection dropdown to ensure you have connected to the database.

In the Query Details section of the dialog box, set the Database Table dropdown to “ERP_ChargeNumber”, indicating that we will find the values we need in that table. Set the DB Field for Dropdown Text dropdown control to “ChargeNumberDescription”. The values in this field are the text values that will display in the ChargeNumber dropdown control. Now set the DB Field for Dropdown Value dropdown control to “ChargeNumber”. The values in this database field will be used as the value of the ChargeNumber control.

At the bottom of the Query Details section, find the button labeled “Test SQL Command” and click it. You should see a message appear at the top and bottom of the dialog box that says “Query Succeeded: 6 records returned.” To let you know that you are pulling the data from the database properly.

In the Form Details section, set the Dropdown to Fill dropdown control to “ChargeNumber”. Process Director will then fill the ChargeNumber Dropdown control with the display text and value column information you selected from the database. Once you’ve done this, click the OK button at the bottom of the dialog box to close and save your configuration changes.


This will return you to the Custom Task Event Mapping tab. It should now look like Figure 78: Fill Dropdown from DB Conditions, below.


We’ve made a lot of changes to the form definition, so click on the OK button at the bottom left of the eForm definition screen to save our changes.


Once the eForm definition is saved, you will be returned to the root folder of the sample project.

  • Was this article helpful?