Bean Shell Form Data Store

The Bean Shell Form Data Store is a tool that allows you to define how form data should be loaded and stored using a script in Java.

Bean Shell Form Data Store also functions as an Options Data Store.

Configure BeanShell

When configuring a Bean Shell Data Form Store, you will be presented with the following form:

Configure the Bean Shell Form Data Store by filling in the following fields:

  • Script: A script in Java. See the Bean Shell Programming Guide for examples.
  • Use AJAX for cascade options?: When checked, this allows fields to dynamically load available options based on the value of another field (grouping column) when dealing with many selections. 
    This does not apply to the Form Data Store; it is only available as an Options Data Store.
  • Sync Cache Interval: indicate how often cache synchronization is activated (in seconds). 
    You can use the Bean Shell Form Data Store combined with the User Option Data Store to return a list of all users in a dropdown selection.

    Setting the Sync Cache Interval to a larger value is recommended if the dropdown selections are unlikely to change frequently. This will prevent the server from repeatedly updating the cache in a short period, thus improving system performance.

    This configuration ensures the server does not perform unnecessary caching and optimizes the form loading.
  • Handling for Field Workflow Variable?: Check this box if you use workflow variables mapping in your form elements. The JDBC Data Store will copy the field value to the workflow variable when the form is submitted if it is mapped to a process. This does not apply to grid elements.
  • Handling for Uploaded Files?: Check this box if you use file or image attachments in your form elements. When you save the form, the JDBC Data Store will save your file or image attachment in the folder. Select a form to store uploaded files only if you are using a form grid or spreadsheet.

Below is a sample script to load data into a field containing a Description with the value "hello world":

import org.joget.apps.form.model.*;

FormRowSet f = new FormRowSet();
FormRow r1 = new FormRow();
r1.put("description", "hello world");
f.add(r1);

return f;

The result is the following:

For more details and examples, see the Bean Shell Programming Guide and the Ajax Cascading Drop-Down List documentation.

Created by Julieth Last modified by Aadrian on Dec 13, 2024