Previous Topic

Next Topic

Book Contents

Book Index

Events Sequences

Navigator > Setup > Company > Scripts > Script Events

Form events and data events interact with each other, and are triggered in fixed sequences.

The general triggering sequence is:

Form.BeforeSave

Data.BeforeSave

Data.AfterSave

Form.AfterSave

See Events Documentation for a list of available events for each form.

Aborting or stopping Event Sequences

If any event in the sequence is aborted or stopped due to failed validation, none of the subsequent events will be triggered.

This particularly affects AfterSave events. If you use an AfterSave event that must always be triggered when a Save succeeds, for example where information is added or updated elsewhere as a consequence of the Save, use Data.AfterSave, not Form.AfterSave.

Event scripts error if they leave the trigger object in a different edit state from the state when the event was triggered, i.e. if you call Save in a BeforeSave event or call Edit and do not Save in an Aftersave, or BeforePost or AfterPost event it will result in an error.

Note: This does not apply to cancelling a Print. Cancelling a Print does not abort any events, as it is an independent process, and the OnPrint event has already been triggered.

AfterPrint events available on some document data objects will automatically put the document in edit mode (if it can be edited). Any changes made to the document inside the event will not require an explicit save. Aborting inside the event will abort any changes made by the user, but not the actual print (which has already happened by this stage), and not the change of the PrintStatus.

Form Operation Event Sequences

When a form operation has to trigger a Save (for example, Print, Post, Cash Sale, Print Labels) and also triggers form or data events itself, the order of events is as follows:

Operation

Event Sequence

Save and Post

  1. Form.BeforeSave
  2. Data.BeforeSave
  3. Data.AfterSave
  4. Data.BeforePost
  5. Data.AfterPost
  6. Form.AfterSave

Save and Print

  1. Form.BeforeSave
  2. Data.BeforeSave
  3. Data.AfterSave
  4. Form.OnPrint
  5. Form.AfterSave

Cash Sale (when editing)

  1. Form.BeforeSave
  2. Data.BeforeSave
  3. Data.AfterSave
  4. Data.BeforePost
  5. Data.AfterPost
  6. Form.OnPrint
  7. Form.AfterSave

IC Transfer

  1. Data.BeforeDispatch
  2. Post Dispatch Process
  3. Data.BeforeReceipt
  4. Post Receipt Process
  5. Data.AfterDispatch
  6. Data.AfterReceipt (Accredo Saturn Only)

 

Note: Data events are only available with DI present.