Epesi ENS | Epesi Academy | epesi.cloud PaaS | GitHub

Help Me! | Download from SourceForge Download Epesi BIM Free & Open Source CRM


how i can call criteria from contact which have specifik group example get all contacts where group = "customer"


public static function test_employees_crits(){
// my code
return
array('(company_name'=>CRM_ContactsCommon::get_group(),'|related_companies'=>array(CRM_ContactsCommon::get_main_company()));
return array();
}

public static function get_group() {
$me = CRM_ContactsCommon::get_my_record();
if (!isset($me['group'])) return -1;
return $me['group'];
}

From: http://www.epesi.org/index.php?title=Ut ... ordBrowser

get_records()
When we need to get multiple records that meet various conditions, get_records is the way to go:

Utils_RecordBrowserCommon::get_records($record_set, $crits = array(), $cols = array(), $order = array(), 
$limit = array(), $admin = false);

This method is fairly complicated. First of all, you need to pass the RecordSet name so RB will know which records to retrieve. Please keep in mind that by default only active (i.e. not deleted) records are gathered.
Second argument is so-called crits - criteria or conditions that records must meet to be placed in result pool. Crits take form of an array, where key is the column key (possible with various modifiers) and value is the value record must contain in this field. If the value is given as an array, it's treated as alternative - if record's value meets any of the values in the array - it's qualified for that criteria.

Your recordset is "CRM Contacts" and crits (the filter) is group "customer" therefore this should work:

$recordset = 'contact';
$crits = array('customer');
return Utils_RecordBrowserCommon::get_records($recordset, $crits);

teh filter is not active, its show all record. i am just need the contact with "customer" group

[quote="apdentalsystem":3167amkd]teh filter is not active, its show all record. i am just need the contact with "customer" group[/quote:3167amkd]
thanks for help, the problem is solve

Write a Reply...