Examples of Hooks and Scripts
Hook examples provide a general idea of how you might add hooks to your schema. Rational® ClearQuest® examples do not include error checking and assume that each call is to a valid object. You should check the return value of the Validate API to ensure there is no error before you commit the record to the database.
Because hooks run with administrator privileges, these examples work even if the behavior of the fields is read-only.
This section provides the following hook examples:
- Conceptual examples
- Opening a prepopulated form
- Opening a URL
- Generating a custom error message
- Getting and setting attachment information
- Building queries for defects and users
- Updating duplicate records to match the parent record
- Managing records (entities) that are stateless and stateful
- Extracting data about an EntityDef (record type)
- Extracting data about a field in a record
- Using field path names to retrieve field values
- Showing changes to a FieldInfo (field) object
- Showing changes to an Entity (record) object
- Running a query and reporting on its result set
- Running a query that has dynamic filters
- Getting a list of defects and modifying a record
- Sorting a result set
- Getting session and database information
- Running a query against more than one record type
- Creating a dependent choice list
- Triggering a task with the destination state
- Adding and removing users in a group
- Upgrading user information
- Workspace security example
- Field hook examples
- Action hook examples
- Record script example
- Global script example
- Using CAL methods in hook scripts
- Using CtCmd with Perl scripts for Rational ClearCase® integrations
- Advanced reporting and automation with cqperl
In addition to the examples of hooks and external applications provided in this chapter, see the following resources:
- Rational ClearQuest Designer Help > Working with hooks
- For an indexed listing of sample Rational ClearQuest hook scripts, see the Rational ClearQuest hooks index page http://www.ibm.com/developerworks/rational/library/4236.html on IBM® developerWorks®.