I have added custom fields to some of my modules. And I want to filter data by those custom field. I can see when custom fields are added to a module they are stored in a separate table.
With the record list service I know I can pass a saved filter/search filter
criteria: {
name: ‘default’,
filters: {
contact_id: {
field: ‘contact_id’,
fieldType: ‘id’,
operator: ‘=’,
} as SearchCriteriaFieldFilter,
} as SearchCriteriaFilter,
orderBy: ‘date_due’,
sortOrder: SortDirection.DESC,
searchModule: ‘Tasks’,
},
do custom field get referenced the same way? Can I reference it the same way even though its not in the same table?
Yea, maybe it will allow, but I am not sure.
If you’re writing a SQL query, definitely you need to use accounts_cstm table instead of accounts table.
yeah I am just not sure how that translates into passing the filter object to the record service.
Okay, I have no idea about it.
Given that the current list views allow you to filter on custom fields, and those list views use the same RecordList service I would imagine you can yes, just remember that custom fields created in studio are all _c.
update: I have hunted through the code a bit and it uses a library in /legacy/include/portability/ListView to build the actual queries if you want to look a bit more in depth.
Mark
HI guys so the feedback was in the var defs we just didnt assign it to custom field which means it doesnt get added to a custom table but actually the main table
$dictionary['Contact']['fields']['identity_no'] = array(
'name' => 'identity_no',
'vname' => 'LBL_IDENTITY_NO',
'labelValue' => 'Identity Number',
'type' => 'varchar',
'len' => 32,
'isnull' => true,
'inline_edit' => true,
'full_text_search' => array(
'enabled' => true,
'searchable' => true,
),
);
This meants we can query it like normal.
1 Like