Jump to content

Triggers: Difference between revisions

From NusaATK
No edit summary
No edit summary
Line 15: Line 15:
If the trigger is a pre- trigger, you can make the argument to be a pointer and you can adjust the record before it is added/updated/deleted.
If the trigger is a pre- trigger, you can make the argument to be a pointer and you can adjust the record before it is added/updated/deleted.


Pre-trigger returning false does not necessarily halt the action being performed. To actually halt the action, use the triggerError-function. Doing so will add an entry in the record called 'atkerror'. Upon detecting this, the action will halt.
Pre-trigger returning false does not necessarily halt the action being performed (because of backwards compatability). To actually halt the action, use the triggerError-function. Doing so will add an entry in the record called 'atkerror'. Upon detecting this, the action will halt.
And the message in the atkerror entry will be displayed as an error. For more information on the triggerError function, please see [http://www.achievo.org/docs/atk/latest/atk--/_atktools.inc.html#functiontriggerError the API documentation on the function].
And the message in the atkerror entry will be displayed as an error. For more information on the triggerError function, please see [http://www.achievo.org/docs/atk/latest/atk--/_atktools.inc.html#functiontriggerError the API documentation on the function].

Revision as of 13:44, 15 September 2006

You can use the following triggers on a node:

  • preAdd
  • postAdd
  • preUpdate
  • postUpdate
  • preDelete
  • postDelete

to perform various tasks after or before an action has been executed.

These triggers take only 1 argument, which is an array with the record.

Pre triggers

If the trigger is a pre- trigger, you can make the argument to be a pointer and you can adjust the record before it is added/updated/deleted.

Pre-trigger returning false does not necessarily halt the action being performed (because of backwards compatability). To actually halt the action, use the triggerError-function. Doing so will add an entry in the record called 'atkerror'. Upon detecting this, the action will halt. And the message in the atkerror entry will be displayed as an error. For more information on the triggerError function, please see the API documentation on the function.