Title: Event Script Hands on Training
1Event ScriptHands on Training
- Putting the Automation in Accela Automation!
2Goals
- Understand basic scripting concepts
- Learn the capabilities of the Event Manager
Script Engine - Learn what Master Scripts are and how they work
- Hands-on Exercises
- Case Studies
3Basic Scripting Concepts
- What is an Event?
- Action triggered by a user
- Submit button on a form
- Saving data
- 76 Unique Events Defined in Accela Automation (20
added from last year)
4Basic Scripting Concepts
- Event types
- Before
- Prior to database action
- Database action can be cancelled via script
- Typically used for validation
- Example ApplicationSubmitBefore
- After
- After database action completes
- Typically used for automation
- Example ApplicationSubmitAfter
5Basic Scripting Concepts
- What is a Script?
- JavaScript code
- Stored in the database
- In order to be executed, must be attached to
- Event,
- Batch Job, or
- Script Test
6Basic Scripting Concepts
7Capabilities of the EMSE
- Task Automation
- Data Validation
- Modifying Data
- Batch Jobs
- Communication
8EMSE Layers
AccelaAutomation
AccelaIVR
AccelaWireless
Master Scripts
Event Manager Script Engine (EMSE)
Accela Automation Application Server
Database
9Master Scripts
- Standardized scripts
- One script per event
- Standard Choice entries control the script
- Modular, plug in functions
- Minimal JavaScript knowledge required
10Why Master Scripts?
- Native Scripts
- Target consumer programmers
- Entirely JavaScript
- Compiled on execution
- Limited end-user documentation
- Hard to decipher
- No built-in value population
- No built-in business logic
- Master Scripts
- Target consumer administrators
- JavaScript framework within AA
- Interpreted at execution
- Extensive docs and examples
- Easy to read and understand
- Frequently used values are populated
- Built in functions for common tasks
11Master Script Flow of Execution
Script Controls
Master Script
Event
12Script Controls
- Script Controls
- Uses Standard Choices items
- Determine the flow of execution
13Script Control Design
Script Action Item matches value in related
Master Script
order of execution
Script Control setting logging options
Script Control with Criteria and Action
Enable or Disable this Script Control
14Script Control Basics
- Script Controls
- Are case-sensitive!
- Do all the work. Criteria tells when, Action
tells what - Criteria and Actions separated by a caret ( )
- Must be valid JavaScript
- Use curly braces "" and "" to reference
- Application Specific Info fields
- Task Specific Info fields
- Parcel custom attributes
15Script Control Structure
separator ()
Criteria
Action
appMatch("Building/Reroof/NA/NA")
addAllFees("BLDCR05","FINAL",1,"N")
IF this is true,
THEN do this
16Master Scripts Criteria
- Criteria
- Must evaluate to only "True" or "False
- May contain multiple statements, separated by
logical operators
17Master Scripts Criteria Examples
- true
- appMatch(Building/Commercial//)
- inspType Final Inspection
- Government Funded "Yes"
- Building Type ! Historical"
- ParcelAttribute.Neighborhood "Downtown Area
- feeExists(LICFEE) balanceDue 0
- inspType Final !isScheduled(Electrical)
- proximity(GIS,Schools,1000)
- taskStatus(License Issuance,Issued)
18Master Scripts Actions
- Action
- Usually call functions developed for common
actions - May contain multiple statements (separated by
semi-colon) - May call subroutines using the branch() function
19Master Scripts Action Examples
- activateTask(Plan Review)
- addFees(RENEW,LICENSE,PER2005,1,Y)
- addAppCondition("Permit","Applied","Reinspection
Fee","Re-Inspection Fee","Hold") - closeTask(Peer Review,NA,Closed by
Script,Closed by Script) - comment(Square footage is Sq Ft)
- childApp createChild(Building,Commercial,Pl
umb,NA,) - editAppSpecific(Total Value,Sq Ft Price
per Sq Ft) - branch(CALCVALUES)
20Master Scripts Global Variables
- Script Global Variables
- Event dependent
- Workflow wfTask, wfStatus, wfDate, etc.
- Inspection Result inspType, inspResult,
InspGroup, etc. - Debug pop-up window shows the full list
21Master Scripts Debug Output Sample
CAP that triggered the event
Pre-populated CAP values available to your script
Event specific values
User-defined data (ASI, TSI, Parcel attributes,
etc.)
22Master Scripts Branching
23Script Error Messages
- Error messages appear in pop-up window
- Common messages
- undefined syntax error (script line xxx)
- undefined unterminated string literal (script
line xxx) - undefined Cannot convert null to an object.
24Script Controls Design Method
- Step by Step
- Identify triggering Event
- Find Master Script for the Event
- Add Master Script to agency
- Add Event to agency
- Associate Script to Event
- Create Script Control
- Test
25Use Cases
- Use Cases to be demonstrated
- Adding fees on application submittal
- Auto-scheduling inspections
- Updating workflow after inspection resulted
- Emailing inspection results
- Accessing GIS info and proximity alerts
- Add re-inspection fees and conditions
- Creating child applications
- Preventing inspection scheduling
26Wrap Up
- Next Steps
- Webex Training
- Resources
- Accela Portal
- Scripts
- Documentation
- Sample Solutions
- Question and Answer