GetRequestorSearches

Syntax

sub GetRequestorSearches

Back to top

Description

This function allows adding searches to the Requestors Web Interface. It receives the requestor's user properties as input, as well as the name of the page in the Requestors Web Interface on which the search should appear. It returns a search on the specified page.

Note: By default, requestors can only view change requests that they requested themselves. Therefore, if the hook returns a search query with change requests that other users requested, those change requests will not appear. To enable displaying change requests requested by other users, it is necessary to assign requestors this permission. See Working with Permissions (see Manage user permissions).

Back to top

Input Parameters

$requestor

A hash reference to the requestor's user properties.

For a list of user properties that are included in the hash. For information on modifying the list of included properties, see Configuring the List of User Properties (see Configuring Requestor User Properties).

$friendly_status

The Requestors Web Interface page that is currently being displayed. This can have the following values:

  • Open
  • Awaiting Response
  • Closed

Back to top

Return Values

An array, in the following format:

my $search = {Field1 => Value1, Field2 => Value2, ...};

Where each field in the array is a hash reference representing a search.

Supported fields are:

Title

The search's title. This will appear in the Requestors Web Interface.

This field is mandatory.

Format

A string containing a comma-separated list of columns that should be included in the search results.

For example:

my $Format = qq{

'<B><A HREF="}. RT->Config->Get('WebPath')
.qq{/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:Id',

'<B><A HREF="}. RT->Config->Get('WebPath')
.qq{/SelfService/Display.html?id=__id__">__Subject__</a>
</B>/TITLE:Subject',

'__CustomField.{Workflow}__',Status,OwnerName,Priority,CreatedRelative,LastUpdatedRelative};

This field is mandatory.

Query

An SQL query. For example:

Queue = 'Firewalls' AND id > 100 AND Requestor.EmailAddress LIKE 'algosec.com'

Note: If a field is missing from the query, a warning will be written to the log and the search will not be displayed.

This field is mandatory.

OrderBy

An array of columns names, indicating the column by which search results should be sorted by default.

The default value is ('LastUpdated'). This field is optional.

Order

An array indicating the default sort order of the search results. This can have the following values:

  • ASC. Show the oldest search results first.
  • DESC. Show the most recent search results first.

The default is ('DESC'). This field is optional.

Rows

The number of search result rows to display per page.

The default value is null. This field is optional.

For example:

my $search = {Title => "The title of the search",Format => $Format,Query => $Query,Order => @Order,OrderBy => @OrderBy,Rows => $Rows;

Back to top