FireNamedHook
Description
Executes a named hook (record script) of this record's EntityDef Object.
You can use this method to execute a record script at runtime. Record scripts are routines you define and are specific to a particular record type. You can use record scripts in conjunction with form controls or you can call them from other hooks. You define record hooks using DevOps Plan Designer.
You cannot use this method to execute a field or action hook of a record. Neither can you execute a global hook, except indirectly from the record script.
You can call this method on an Entity object regardless of whether or not
it is editable. However, if your script attempts to modify the Entity object, either
your code or the hook code must first call EditEntity method to make the Entity object
editable.
You can include multiple parameters by concatenating simple string values
with a non-printing character as a separator (such as newline). This String can then be
decoded with the built-in split operator.
Syntax
Perl
$entity->FireNamedHook(scriptName, param);
- Identifier
- Description
- entity
- An Entity object representing a user data record. Inside a hook, if you omit this part of the syntax, the Entity object corresponding to the current data record is assumed.
- scriptName
- A String containing the name of the hook to execute.
- param
- A String containing the parameters you want to pass to the hook.
- Return value
- A String indicating the status of calling the hook. If the hook executes successfully, this method returns an empty string (""), otherwise the returned string contains a description of the error.
Example
Perl
# Execute the hook "MyHook" with the specified parameters
$params = "option 1\noption 2";
$returnValue = $entity->FireNamedHook("MyHook",$params);
# In the hook, split them like this:
my $param = shift;
my @params = split '\n', $param;