Understanding the Event Manager and Script Engine
The Event Manager and Script Engine (EMSE) comprise two separate tools that work together to automate and simplify agency processes. The Event Manager identifies events, such as scheduling an inspection, and launches a related script. The Script Engine produces an effect based on the parameters that Event Manager passes to it and the design of the script used to process the event. You can use the Event Manager to make your system more efficient and perform a high level of customization on your system.
You associate the events with the script that you want to execute (Events and Their Associated Scripts).
Example Use Case
You want Civic Platform to automatically update the task status in an inspection workflow when you schedule an inspection.
Topics
Understanding Events
An action that a user performs through the Civic Platform UI, clicking the Submit button to create a new record for example, constitutes an event (Launching a Civic Platform Event). These events initiate some sort of reaction that may affect other parts of your system. For example, when you create a new record and save it, Civic Platform updates information on your system, as required.
Other possible events include finding a record, assessing a fee, scheduling an inspection, and so forth. Civic Platform provides 238 events with which you can associate scripts. You cannot create new events, but you can choose the events to set up for your agency and disable the events that you do not use.
You can trigger events from Civic Platform clients, such as Mobile Office, IVR, and Citizen Access, or from integrated third-party products.
Civic Platform provides before and after event types (Triggered event process flow).
The before event occurs before you save any data to the database. Scripts associated with before event types validated data to ensure the process saves clean and accurate data to the database.
Example Use Case
Check to ensure that the balance due for a record (permit or license, for example) is less than or equal to zero before issuance
Check to ensure that all required inspections have passed, before scheduling a final inspection.
Check to ensure submission of all required documents, before processing an application.
The after event occurs directly after the Civic Platform saves submitted data to the database. Scripts associated with an after event implement automation of an action for the user.
Example Use Case
Assess and invoice standard fees or application dependent fees.
Schedule an investigation inspection for the next business day after filing of a complaint.
Email a PDF copy of a license, to the license holder, upon issuance or renewal.
Understanding Scripts
Civic Platform uses scripts to perform custom activities to extend standard event processing. When run, a script produces an effect on the objects defined in your system, such as records, parcels, addresses, and so forth.
Civic Platform provides a set of master script files that extend functionality for the 238 events. For some (56) events, Civic Platform provides a master script file unique to that event. For the other events, Civic Platform provides a universal master script.
Each master script file provides a variety of different functions you can invoke for an event. To determine the specific functions you want executed, you specify parameters in a standard choice script control. Each master script uses a comparably named standard script control to pass it parameters it needs to execute the specific functions for an event.
You can trigger a script from an event, a batch job, a set script or a script test. See Understanding Events for more information.
Note:
Civic Platform uses the Rhino open source JavaScript engine to convert master scripts into Java classes that Civic Platform can execute. |
Topics
Batch Jobs
Batch jobs trigger scripts through a scheduled job in contrast to a user-invoked action. For example, you can schedule a nightly batch job, with an associated script, that looks for expired permits or licenses and updates them to an expired application and/or expiration status. At a high level batch scripts contain instructions to query records based on a specified filter, evaluate each returned record and take action for each record according to certain criteria. Civic Platform provides the Batch Job portlet (Batch Jobs Portlet) from where you can use UI controls to set parameters for the associated batch job script.
Set Scripts
You can associate a set script to the “Execute Script” button on the Set portlet (Set Portlet). The script contains instructions to evaluate each member (record) of the selected set and take action if the member falls into the specified criteria.
Example Use Case
Manage an invoicing process.
Run a batch script to evaluate records and determine if you require an invoice. If so, add the record to a set.
Review the generated set for accuracy; add or remove records as required.
Execute the script from the set portlet.
The script evaluates each record; if it meets specified criteria take the appropriate action (eg. update the record, send an email or generate invoices reports).
Script Test
Civic Platform provides the Script Test tool for EMSE script writers. This tool enables you to enter and execute EMSE scripts with no affect on the Civic Platform database. The script writer can evaluate the output of the script to determine further development effort and testing. You can use the Script Test tool to:
develop and test batch scripts
develop and test custom functions
troubleshoot and debug EMSE scripts.