GetHookSeesAllRecords
Description
Returns a Boolean that indicates whether the current hook sees all records or only the records that the current user is allowed to see. True means the current hook sees all records when it executes a query. False means the current hook can only see records the current user is allowed to see when it executes a query.
Syntax
Perl
session->GetHookSeesAllRecords();
- Identifier
- Description
- session
- The Session object that represents the current database-access session.
- Return value
- Returns a Boolean True if the current hook sees all records when it executes a record query. Returns False if the current hook can only see records the current user is allowed to see when it executes a record query.
Example
Perl
sub project_ChoiceList
{
my($fieldname) = @_;
my @choices;
# $fieldname as string scalar
# @choices as string array
# record type name is Defect
# field name is Project
my $session = $entity->GetSession();
my ($curHookSessAllRecords);
# store current "Context"
$curHookSessAllRecords=$session->GetHookSeesAllRecords();
# set to "User Context"
$session->SetHookSeesAllRecords(0);
my ($queryDefObj, $resultSetObj);
$queryDefObj = $session->BuildQuery("Project");
# have the query return the desired
# field of the user object(s)
$queryDefObj->BuildField("Name");
$resultSetObj = $session->BuildResultSet($queryDefObj);
# run it
$resultSetObj->Execute();
# add each value in the returned column to the choicelist
while
($resultSetObj->MoveNext() == $CQPerlExt::CQ_SUCCESS) {
push(@choices,$resultSetObj->GetColumnValue(1));
}
return @choices;
}