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
- Setup a script repository, which includes a scripts folder organized by trigger mechanisms such as events, batch, expressions, etc.
- Copy the contents of the UniversalMasterScript file and paste the contents into your script editor.
- Modify the configurable parameters, as described in Configuring the Universal Script.
- 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.
- Save the JavaScript file using the script file naming convention.
- Deploy the custom script using the EMSE tool.
Using the Legacy Standard Choice Script Controls
To create a new script:
Copy the contents of the UniversalMasterScript file and paste the contents into your script development environment (text editor or IDE).
Save the new script file with the same base name as the event to which you plan to associate the new script.
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).
Modify the new script file as required (Configuring the Universal Script).
Install the script file (Event and Script Setup).