callCustomEvent
This function allows the User to call a Custom Event. This enables flexibility and allows for modularization when creating Custom Logic.
mixed callCustomEvent(string $eventIdentifier, array $data)
Parameters
$eventIdentifier: The Custom Event Identifier.
$data: An array of data passed to the custom event
Return Values
The return Captures whatever is returned from inside the target Custom Event.
Scope
$data
$params
A key/value paired array of parameters that were passed into the $data['params']
of the Custom Event. This is essentially a subset of the $data
.
$user
A key/value paired array of User information about the currently logged in User. The example below shows options that are available in this array. This information will be minimal for Scheduled Events.
$user = [ 'isSysAdmin' => TRUE 'isCoordinator' => FALSE 'isCustomerCenterOnly' => FALSE 'attributes' => [ 'USERS_RECID' => 494, 'USERID': "demo", 'CONTACTS_RECID' => 1 'NAME' => 'Pcr Demo' 'FIRST_NAME' => 'Pcr' 'LAST_NAME' => 'Demo' 'DEPT_HIERARCHY_RECID' => NULL 'TENANTS_RECID' => 0 'EMAIL' => 'demo@pcr.com' ] ]
Example
// this is the Custom Event: myEvent $this->debug($data); $this->debug($params); $this->debug($user); $this->debug($backtrace); return 'myEvent was called';
$result = $this->callCustomEvent('myEvent', ['some' => 'data']); // $result will equal "myEvent was called" // the debug tab on myEvent will show the $data array