Creating a New Script

Civic Platform provides master scripts for most of the events. You use the UniversalMasterScript as a template to create scripts for the remaining events.

Civic Platform requires a separate script per event to:

  • Identify the entry point Standard Choice that contains the script controls for that event's desired actions (for scripts using the legacy Standard Choice script controls)

  • Identify the scripted business logic for a module, application type, and sub-type (for scripts using the JavaScript framework).

  • To create and populate event-specific variables needed for each specific event (eg. wfTask, inspType)

A traditional practice to create custom scripts is to use the legacy Standard Choice script controls, as described in Using the Legacy Standard Choice Script Controls. A better way to create custom scripts is by Using the JavaScript Framework.

Using the JavaScript Framework

Instead of using Standard Choices and script controls in your custom scripts, Accela recommends the use of the JavaScript Scripting Framework. It simplifies script development by using the standard JavaScript syntax without the restrictions of Standard Choice script controls. The following summarizes the process:
  1. Setup a script repository, which includes a scripts folder organized by trigger mechanisms such as events, batch, expressions, etc.
  2. Copy the contents of the UniversalMasterScript file and paste the contents into your script editor.
  3. Modify the configurable parameters, as described in Configuring the Universal Script.
  4. Implement your business logic using JavaScript syntax.
    Note: A custom script using the JavaScript framework no longer requires the legacy Standard Choice script controls. See Comparing the JavaScript Framework with Legacy Script Controls for details.
  5. Save the JavaScript file using the script file naming convention.
  6. Deploy the custom script using the EMSE tool.

Using the Legacy Standard Choice Script Controls

To create a new script:

  1. Copy the contents of the UniversalMasterScript file and paste the contents into your script development environment (text editor or IDE).

  2. Save the new script file with the same base name as the event to which you plan to associate the new script.

  3. Create a new standard choice with the same name as the event. This standard choice becomes the entry point standard choice for this event (Script Controls).

  4. Modify the new script file as required (Configuring the Universal Script).

  5. Install the script file (Event and Script Setup).