request_created

Triggered on the creation of a new request.

Helpdesk

Input (passed by reference)

$params array Request properties.
$params['source'] helpdeskSource Request source class instance.
$params['creator_contact'] waContact Request author contact class instance.
$params['client_contact'] waContact Request client contact class instance.
$params['request'] helpdeskRequest Request class instance.
… your plugin code …

Output

Helpdesk

Plugin code example

PHP

public function requestCreated($params)
{
    if ($params['creator_contact'] instanceof waContact) {
        $message = sprintf_wp(
            'Request #%d (“%s”) has been created by %s on behalf of %s.',
            $params['request']->getId(),
            $params['request']->summary,
            $params['creator_contact']->getName(),
            $params['client_contact']->getName()
        );
    } else {
        sprintf_wp(
            'Request #%d (“%s”) has been created on behalf of %s.',
            $params['request']->getId(),
            $params['request']->summary,
            $params['client_contact']->getName()
        );
    }

    waLog::log($message, 'myplugin.log');
}