Background

Javascript is a language developed for deployment and execution inside web browsers.  From a workflow perspective, javascript is used to provide cross-browser customized business logic. Each customized javascript function call is stored in the Workflow database.  This means that business logic is data-driven, and independent from the core Workflow software or code.  In short, customized code and the core Workflow system are unaffected by changes to one another.  Examples of javascript functions are available.

 

Event Handlers

 

Workflow tasks and fields may have javascript logic applied to them via the following event handlers:

  • Task On Load: fired by the client when the task page has been delivered to the browser
  • Task On Unload: fired by the client when the user navigates out of the task page
  • Task On Change: fired by the client when any field in the task is changed
  • Task On Save: fired by the client when the task Save button is clicked.
  • Task On Cancel: fired by the client when the task Cancel button is clicked
  • Server On Save Before: fired by the server just before saving task and field information
  • Server On Save After: fired by the server just after saving task and field information
  • Server On Cancel: fired by the server after clicking Cancel from a task
  • Server On Load: fired by the server after establishing all database connections
  • Server On Unload: fired by the server just before redirecting to another page
  • Field On Change: fired by the client when the field value is changed.
  • Field On Focus:  fired by the client when the cursor enters the field.
  • Field On Blur: fired by the client when the cursor leaves the field.
  • Field On Save: fired by the client when a task Save button is clicked.
  • Field On Cancel: fired by the client when a task Cancel button is clicked.

The field event handlers are used to validate the data entered inside a field.  Task event handlers are used to validate relationships between fields in a task.

 

Standard Javascript Functions

 

Javascript has an extensive function set available.  Before attempting customized business logic, you should be familiar with the following:

  1. HTML
  2. W3C document object model
  3. Workflow data structure

Documentation is available at:

Workflow can make use of any browser-support scripting technology (e.g. visual basic scripting).  Aspen Grove recommends the use of javascript because it works consistently in both Netscape's Navigator and Microsoft's Internet Explorer.

 

Workflow Javascript Functions: Server-Side

Aspen Grove has developed a set of javascript functions to help fire off Server side logic, available for use in javascript business logic.  Example include:

 

Workflow Javascript Functions: Client-Side

Aspen Grove has developed an extensive set of javascript validation routines, available for use in javascript business logic.  Example include:

  • isMoney(theField): validates that a field contains a valid monetary value
  • isDate(theField): validates that a field contains a valid date
  • isPhone(theField): validates that a field contains a US formatted telephone number
  • isSSN(theField):  validates that a field contains a US formatted social security number
  • defaultOption(theField, theValue): sets the value of a drop-down list based on value
  • defaultOptionText(theField, theValue): sets the value of a drop-down list based on text
  • defaultCheck(theField, theValue): turns on a check box if appropriate
  • setStatus(theMessage): sets the message in the browser's status bar
  • setPopup(theURL): opens a popup help-sized window
  • getObject(theSQL, theObject, theForm): sets the values of a form based on a server-side database call
  • getList(theSQL, theObject, theList):  sets the values of a drop-down list based on a server-side database call

 

Examples

 

Client-Side Examples:

  1. Prompt a user to generate documents after saving a task
  2. Calculate a total field in a task
  3. Compare date fields
  4. Using task dates from other tasks
  5. Conditional Triggering
  6. Overwriting calculated fields
  7. Inserting Notes with Javascript
  8. Logging other events with Javascript
  9. Controlling re-projection of dates
  10. Controlling what users may change a field's value
  11. Adding tasks to a process automatically
  12. Placing a process on hold and closing a process
  13. Adding items to Lookups from within a task

Server-Side Examples:

  1. Place a Process on hold

  2. Close a Process
  3. Resume a Process
  4. Add an exception task
  5. Reassign one or more tasks (client, vendor, team, person)

See Also