Hi There,
I am looking to implement custom filters with 'OR' expression for two different field , As in sugar we can not use 'OR' expression for two different fields , it's working for same field.
How can i implement it for two different fields ?
Hi There,
I am looking to implement custom filters with 'OR' expression for two different field , As in sugar we can not use 'OR' expression for two different fields , it's working for same field.
How can i implement it for two different fields ?
As per documentation for endpoint filterList, a structure like that should work:
$viewdefs['Accounts']['base']['filter']['basic']['filters'][] = array( 'id' => 'filterRQPartners', 'name' => 'LBL_FILTERRQPARTNERS', 'filter_definition' => array( array( '$or' => array( 'ignore_dealer_in_report_c' => array( '$equals' => 0 ), 'dead_2_c' => array( '$equals' => 0 ), ), ), ), 'editable' => false, 'is_template' => true, );
Regards
As per documentation for endpoint filterList, a structure like that should work:
$viewdefs['Accounts']['base']['filter']['basic']['filters'][] = array( 'id' => 'filterRQPartners', 'name' => 'LBL_FILTERRQPARTNERS', 'filter_definition' => array( array( '$or' => array( 'ignore_dealer_in_report_c' => array( '$equals' => 0 ), 'dead_2_c' => array( '$equals' => 0 ), ), ), ), 'editable' => false, 'is_template' => true, );
Regards
I have already tried this but it's not working for two different fields.
Let me explain the scanario in more details. As per below screenshot , I want to use these 2 filter auto select on one of the dropdown selection , As per sugar default flow , For these 2 fields , 'AND' expression is being used , but i have to use 'OR' expression .
Below are the code , i used for this :
File : relate.js
selectLocation: function () { var m03_work_product_name = this.model.get('m03_work_product_ii_inventory_item_1_name'); console.log('m03_work_product_name', m03_work_product_name); var filterOptions = new app.utils.FilterOptions() .config({ 'initial_filter': 'FilterTestSystem', 'initial_filter_label': 'Current Work Product Assignment', 'filter_populate': { 'assigned_to_wp_c': m03_work_product_name, 'm03_work_product_id_c': ['4a529aae-5165-3149-6db7-5702c7b98a5e'] }, 'filter_relate': { 'assigned_to_wp_c': m03_work_product_name,'m03_work_product_id_c': ['4a529aae-5165-3149-6db7-5702c7b98a5e'], }, }) .populateRelate(this.model) .format(); //this custom code will effect for all relate fields in Enrollment module.But we need initial filter only for Test system relate field. filterOptions = (this.getSearchModule() == "ANML_Animals") ? filterOptions : this.getFilterOptions(); app.drawer.open({ layout: 'selection-list', context: { module: this.getSearchModule(), fields: this.getSearchFields(), filterOptions: filterOptions, } }, _.bind(this.setValue, this)); },
file : Filtertest.php :
$viewdefs['ANML_Animals']['base']['filter']['basic']['filters'][] = array ( 'id' => 'FilterTestSystem', 'name' => 'Current Work Product Assignment', 'filter_definition' => array( array( '$or' => array( 'assigned_to_wp_c' => array( '$equals' => '' ), 'm03_work_product_id_c' => array( '$in' => '' ), ), ), ), 'editable' => true, 'is_template' => true, );
By using this , no filter is working , Please check and suggest me any solution.