Skip to main content

Advanced query

You can modify the query executed to load the data in ListView, RelatedList and Popup mode in order to limit or extend the visibility of the data. This does not affect Administrator users, who have access to all data; in addition, the module must be set as Private.

Editing the query is done through a custom php function (see below). Only one function of this type can be used in each module. To register the function use:

SDK::setAdvancedQuery($module, $func, $src);

$module : the module in which to apply the function (if a function is already registered for the module, the new one is not inserted)
$func : the name of the php function
$src : the php file that contains the function

To remove the customization:

SDK::unsetAdvancedQuery($module);

$module : the name of the module

The $func function must be defined as follows:

<?php

function myFunction($module) {
	// Your code ... 
}

$module : the module that calls the function

It returns a string:

“” : (empty string) the query is unchanged
? : (not empty string) this string is added to the query

Hooks
data/CRMEntity.php