The Trigger_RegisterFunctionByName() function registers a function trigger for a function in the specified dictionary. A function trigger is activated when a specified function is run.
Trigger_RegisterFunctionByName(product_ID, function_name, attach_type, [function processing_function | script processing_procedure] {, tag})
• product_ID – An integer specifying the ID of the product that contains the function for which the trigger is being registered.
• function_name – A string containing the name of the function for which the function trigger is registered. When this function is run, the function trigger is activated. If the function is a form function, be sure to include the of form form_name clause in the name.
• attach_type – An integer indicating when the function trigger is activated, relative to the original function:
Constant |
Value |
---|---|
TRIGGER_BEFORE_ORIGINAL |
1 |
TRIGGER_AFTER_ORIGINAL |
2 |
• function processing_function | script processing_procedure – A function or procedure you write that runs in response to the function trigger.
• tag – An optional returned integer that uniquely identifies the trigger. This value is used when you want to unregister, enable or disable the trigger individually.
An integer corresponding to the following constants:
Constant |
Value |
Description |
---|---|---|
SY_NOERR |
0 |
No error occurred. |
SY_UNKNOWN |
1 |
An unknown error occurred and the trigger was not registered. |
SY_INVALID_SCRIPT |
2 |
The trigger processing script was either not found or had the wrong number of parameters. The trigger was not registered. |
SY_INVALID_OBJECT |
4 |
The object for which the trigger is being registered cannot be found. |
If a function runs in response to the function trigger, it must have exactly the same set of parameters as the function that is being triggered on. If a procedure runs in response to the function, it can’t have any parameters.