Default entity

The default entity for a hook is created by HCL Compass before a hook starts, and represents the current record upon which an action is being done.

For Perl, you retrieve this object using:

$entity

If you are referencing another entity in the context of one record's action (such as executing a call to the BuildEntity method to submit a new record), you need to maintain the scope of your entity variables. There are two approaches:

  • Use the same variable name for both entities, but declare one of them using my. That makes only one of them accessible at any time, because the my declaration creates a new variable with local scope which masks the existing global definition until the variable goes out-of-scope (for instance, at the end of the current function).
  • Use different variable names for each entity.

For VBScript, you can use the me declaration. For example:

call DoSomething(me)

If you need to explicitly reference the default entity object in order to pass it as an argument, you can use the me declaration to perform operations. For example:

Msgbox me.GetDisplayName()
Dim xme
Set xme = me
Msgbox xme.LookupStateName