Before Command hook

Use this hook to perform additional actions before the command is executed. This hook can use actual values of the form fields. You can cancel the execution of the command by calling the choice.again() function.

If the standard hook must be executed before the extension hook is executed, you can force the standard hook to execute anytime you prefer. This can be achieved by calling the command.super() function.

Example:

function extern dupl.occur.before.command()
{
        command.super()
|* Don’t allow copying purchased items
        if tcibd001.kitm = tckitm.purchase then
                message("It is not allowed to copy purchased items; " &
                   "add a new item to ensure actual defaults are applied.")
                choice.again()
        endif
}

This is an alternative for the Is Enabled hook. You can keep the command enabled and this hook gives a message why a record cannot be copied.