Understanding Expression Builder Scripting

Note:

Civic Platform uses the Event Manager and Scripting Engine (EMSE) to handle default form and portlet data fields.

Expression Builder provides an interface to script client side interactions (or expressions) before triggering an event type. For example, you can use Expression Builder to define expressions that trigger when a form loads, or when a user selects or enters a value in an individual form field. You can use expressions to perform calculations, provide drop-down lists, or auto-populate data fields based on user-selected values.

For information about how to use Expression Builder, see Civic Platform Administration Guide > Configuring Agency Business Objects > Using Expression Builder.

Example Use Case

A user selects a value from a drop-down list in ASI. You create a script for an expression that makes the selected value affect other fields in the form to:

  • Mark fields as required.

  • Mark fields as read-only or hidden as they are no longer required.

  • Pre-populate them based on a calculation or lookup table.

  • Trigger an alert pop-up window or alert message next to other fields.

Example Use Case

A user enters a permit number or license number in an ASI text field. Civic Platform provides a message about the validity of the permit or license number before the user submits the form.

Expressions implement business rules that require users to receive immediate feedback in the user interface before they submit a form. You can use “before” events in the master script framework to perform a similar type of form validation. However, with the master script framework, the user must complete the entire form and submit it before receiving feedback. With expressions, the user receives feedback immediately upon completing an individual field on the form.

Expression Builder provides a wizard to create expressions (see Civic Platform Administrator’s Guide) and Civic Platform generates scripts to implement the expressions that you create through the wizard. You can view and edit the generated expression scripts in an Expression Builder window when you toggle Expression Builder from wizard mode to script mode (Expression Builder Portlet). You can select whether to execute the expressions for Civic Platform only, Citizen Access only, or both.

Figure: Expression Builder Portlet



You can use a combination of field level and form level data validation, depending on your business needs. You can trigger an master script from an expression. See the discussion thread on Accela Community for more information about Expression Builder.

You can configure an expression script to populate form data from an external data source, through an external web services. When connected to an external web service, administrators can generate expressions that use data elements, from an external web service, as variables or data items.

Example Use Case

An agency administrator uses Expression Builder to build and execute an expression for the License Professional portlet. The script interacts with an external web service, such as the State Licensing Board, to check for the current status of a license and whether the Licensed Professional selected in a new application is valid.