AllowDeleteRecords(tableName, selection)

A script handler you can implement to override standard MoneyWorks behaviour.

Automatically called:  When the user is about to delete records from a list.

Use for:  To exercise finer control over whether the current user is allowed to delete certain records. Return TRUE if all of the records in the selection may be deleted. Return FALSE to prevent any of the records in the selection being deleted.

Notes:  Avoid iterating over the records in the selection one at a time, as this may be very time consuming if you are connected to a remote server. Where possible, make the decision based on a search of the selection using IntersectSelection.


on AllowDeleteRecords(table, sel)
    if table = "transaction"
        let no_del = IntersectSelection(sel, `type = "QU@" and analysis = "PRICE"`)
        if RecordsSelected(no_del) > 0
            Alert("Cannot delete", "The selection contains quotes used for your price book")
            return false

Return value:  boolean