Triggers with Default Behavior

Some triggers have default behavior, which is used when the compiler cannot find executable code for the trigger.

Code cannot be executed when the trigger declaration contains:

  • Nothing but the declaration
  • A combination of:
    • Spaces or tabs
    • Comment lines
    • A single end statement

Normally, if an object's trigger is not declared, it inherits the declaration and contents from the modeled parent object. If the object cannot inherit, or the modeled parent does not declare the trigger, nothing happens.

However, the exec operation and a small group of triggers have default behavior. This behavior takes effect if either of the following conditions is true:

  • The trigger is not declared in the local object, and not declared in the modeled object from which it might inherit.
  • The trigger is declared without executable code

In some circumstances, you may want to force the default behavior. For example, an IncludeScript contains a trigger declaration and you want to override this so it is not used. In this case, you can declare the trigger without executable content, or use the undeclare ProcScript command to prevent the trigger from being compiled. For more information, see undeclare.

In other circumstances, you may want to suppress the default behavior, in which case put return (0) or done as the first statement in the trigger.

Default Behavior of Triggers and Operations

At runtime, the following triggers and operations have default behavior if the trigger is not declared and is empty (has no executable code):

Default Behavior of Triggers and Operations
Object Trigger/Operation Default Runtime Behavior
Application Shell trigger apstart Executes done
Component operation exec Depends on the type of component. For more information, see operation exec.
trigger accept Implicitly validates all unvalidated fields, keys and occurrences, and sets return 0 (unless $status is set to a return value)
trigger receiveMessage Passes the request to the trigger receiveMessage of the parent application shell.
trigger menu (Forms only) Fires trigger menu trigger of the application shell.
trigger preactivate Sets return 0
trigger prerequest Executes done
trigger postrequest Executes done
trigger print (Forms only) Executes print/ask.
trigger quit Sets return 0
trigger store Implicitly validates all unvalidated fields, keys, and occurrences, and then executes done
Entities trigger error Entity-level error reporting that is specific to the type of component.
trigger create (Forms only) Creates an occurrence of the entity.
trigger menu (Forms only) Passes the request up to trigger menu of the parent component
Fields trigger error Field-level error reporting that is specific to the type of component
trigger detail(Forms only) Passes the request to the trigger detail of the parent entity
trigger help (Forms only) Passes the request up to trigger help of the parent entity
trigger menu (Forms only) Passes the request up to trigger menu of the parent entity

Related Topics