Previous Topic

Next Topic

Book Contents

Book Index

Form Events

Navigator > Setup > Company > Scripts > Script Events

Form events are triggered when data in Accredo is accessed or manipulated via a form. If data is manipulated at data level (that is, if a script is used to manipulate data objects at data level, bypassing one or more forms) then form level scripts are not triggered. Data level events are only available with DI present.

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

Form events interact with Data events are triggered in sequences, see Events Sequences.

Hint: In Form Event scripts, we recommend you explicitly declare variables using the Dim statement, to avoid confusion between variable names between scripts. See Passing Information Between Events for details of sharing data.

Note: For Line Events, by default, totals are not calculated until the operation is complete. To change this and force totalling per line, use the configuration switch /LineEventSums.

You can use the .OnOpen event to make a standard form unavailable. See Using Events to Control Form Access.

Some examples of form level events are:

Type

Description

Examples

*.Header.AfterChange

Runs after a value is changed.

Can be used when changing a field changes other fields on the form, such as Customer on an Invoice form.

The TriggerField method can be used to identify the field that was changed.

INInvoiceEntryForm.Header.AfterChange - You can compare old and new values after changing.

*.AfterInsert

Runs immediately after a User selects the Insert option on the form.

This can be used to pre-fill certain fields with information that is already available.

ARCustomerForm.AfterInsert - You can pre-fill the Salesperson field with details from the current User.

INInvoiceEntryForm.AfterInsert - You can pre-fill the Origination Date field with today's date.

*.AfterPost

 

Runs after a Post action is executed.

Can be used to specify the next required or logical step for optimum processing.

JCBatchTransactionEntryForm.AfterPost - You can print a report and send it to the factory manager.

*.AfterSave

 

Runs after a Save action is executed.

This can be used to specify the next required or logical step for optimum processing.

Form.Aftersave is triggered only after all events triggered by the same operation have completed.

INInvoiceEntryForm.AfterSave - You can print a mailing label and start a new invoice.

*.Line.AfterSave

Runs after a line is saved.

Use this to apply a script to each line after it is saved.

The ActiveProperty field will return the field that triggered the event.

INInvoiceEntryForm.Line.AfterSave - You can add information on lines.

*.Header.BeforeChange

Runs before a value is changed.

Can be used when changing a field changes other fields on the form, such as Customer on an Invoice form.

The TriggerField method can be used to identify the field that was changed.

INInvoiceEntryForm.Header.BeforeChange - You can compare old and new values before changing.

*.BeforeClose

Runs when a user selects to close a form, before the form is closed.

Can be used to trigger validation rules before a form is closed.

APCategories1GridForm.BeforeClose - You can validate entries in the grid before closing the form.

ICStockGroupForm.BeforeClose - You can validate the form before closing.

*.BeforePost

Runs when a Post option is selected, before the Post action is executed.

This can be used to enforce business rules and ensure forms are completed correctly.

INInvoiceEntryForm.BeforePost - You can calculate bonus points based on Products and quantities purchased, and transfer to Customer records.

*.BeforeSave

Runs when a Save option is selected, immediately before the Save action is executed.

This can be used to enforce business rules and ensure forms are completed correctly.

OESalesOrderEntryForm.BeforeSave - You can check margins against minimum levels set and warn or refuse to save if below target.

*.Line.BeforeSave

Runs after a line is saved.

Use this to apply a script to each line before it is saved.

The Line.TriggerField field will return the field that triggered the event.

INInvoiceEntryForm.Line.BeforeSave - You can validate information on lines before saving.

*.OnClose

Runs after a form is closed.

This can be used to specify the next required or logical step for optimum processing.

APCreditorForm.OnClose - You can open the IC Products form to add or assign products for the new creditor.

GLBatchEditForm.OnClose - You can prompt to print a report.

*.OnOpen

Runs after a User opens a form, before the form is shown.

This can be used to specify default views and preferences.

INInvoiceEntryForm.OnOpen - You can pre-fill the Salesperson field with the User code or pre-fill Origination Date field with today's date.

Use ActiveProperty to set the active control, allowing you to set values on another form or tab.

Set the ActiveProperty = "" to set focus to the primary selection, e.g the customer code on the customer maintenance form.

*.OnPrint

*.OnPrintLabel

*.OnPrintProductLabels

 

Runs after a user selects a print option.

This can be used to specify whether a record needs to be saved before printing.

You can also specify email properties, which will be passed to the Preview form if Mail Report is later selected.

InInvoiceEntryForm.OnPrint - You can run a validation script on key fields before allowing an invoice to be printed.

*.OnShow

Runs after a form is shown.

InInvoiceEntryForm.OnShow - You can open other forms to show in front of the form.

*.BeforeEdit

Runs when the edit option is selected on a document.

InInvoiceEntryForm.BeforeEdit - You can call Abort from here to cancel the edit.

*.AfterEdit

Runs immediately after the edit options is selected on a document.

POPurchaseOrderEntryForm.AfterEdit - You can validate information on the form immediately after Edit is selected.

*.Master.BeforeChange

Runs on a form immediately before a masterfile record is changed.

JCJobForm.Master.BeforeChange - You can capture information in a MasterFile before it is changed.

*.Master.AfterChange

Runs on a form immediately after a masterfile record is changed.

JCJobForm.Master.AfterChange - You can capture information changed in a MasterFile for comparison.

*.AfterAddOrderLine

Runs on the AP Enter Shipments form immediately after a line is added.

APShipmentEntryForm.AfterAddOrderLine - Can be used to add costs to shipment lines.

*.BeforeGenerate

Runs on the IC Manufacture Batch form when Manufacture Component is selected.

ICManufactureBatchForm.BeforeGenerate - Can be used to check a batch has been saved before Manufacture Component is selected.

*.AfterExtend

Runs on the IC Manufacture Batch form after Manufacture Components are extended.

ICManufactureBatchForm.AfterExtend - Can be used to iterate components following expansion to update generated tracking.

Note: When records are posted, the following events all are run in the order: BeforeSave, BeforePost, AfterPost, AfterSave.

In This Section

Using Events to Control Form Access

Using Events to set Batch Selection Defaults