Hi,
I've created a primary filter in Account entity and it works OK, but I've tried to do the same in a custom entity (CProject) in the same way but It shows an error:
[2024-07-08 10:55:19] CRITICAL: (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c_project.status' in 'where clause' :: GET /CProject :: /var/www/html/crm/application/Espo/ORM/Executor/DefaultSqlExecutor.php(77)
I'm sure the table c_project and the column status exist in the DB.
Hard rebuild and clean cache already done.
EspoCRM version: 8.3.4
These are the steps I've followed:
1.- I've created the files Active.php and Inactive.php in /var/www/html/crm/custom/Espo/Custom/Select/CProject/PrimaryFilters
2.- I've created the file CProject.json in /var/www/html/crm/custom/Espo/Custom/Resources/metadata/selectDefs
3.- I've modified the file CProject.json in /var/www/html/crm/custom/Espo/Custom/Resources/metadata/clientDefs adding the filters name.
The filters are shown in the search bar of the entity but appears an Error 500 and the filters don't work.
Thank you for your help
I've created a primary filter in Account entity and it works OK, but I've tried to do the same in a custom entity (CProject) in the same way but It shows an error:
[2024-07-08 10:55:19] CRITICAL: (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c_project.status' in 'where clause' :: GET /CProject :: /var/www/html/crm/application/Espo/ORM/Executor/DefaultSqlExecutor.php(77)
I'm sure the table c_project and the column status exist in the DB.
Hard rebuild and clean cache already done.
EspoCRM version: 8.3.4
These are the steps I've followed:
1.- I've created the files Active.php and Inactive.php in /var/www/html/crm/custom/Espo/Custom/Select/CProject/PrimaryFilters
Code:
<?php namespace Espo\Custom\Select\CProject\PrimaryFilters; use Espo\Core\Select\Primary\Filter; use Espo\ORM\Query\SelectBuilder; use Espo\ORM\Query\Part\Condition as Cond; class Active implements Filter { public function apply(SelectBuilder $queryBuilder): void { $queryBuilder->where( ['c_project.status' => 'Active'] ); } }
Code:
<?php namespace Espo\Custom\Select\CProject\PrimaryFilters; use Espo\Core\Select\Primary\Filter; use Espo\ORM\Query\SelectBuilder; use Espo\ORM\Query\Part\Condition as Cond; class Inactive implements Filter { public function apply(SelectBuilder $queryBuilder): void { $queryBuilder->where( ['c_project.status' => 'Inactive'] ); } }
2.- I've created the file CProject.json in /var/www/html/crm/custom/Espo/Custom/Resources/metadata/selectDefs
Code:
{ "primaryFilterClassNameMap": { "Activos": "Espo\\Custom\\Select\\CProject\\PrimaryFilters\\Active", "Inactivos": "Espo\\Custom\\Select\\CProject\\PrimaryFilters\\Inactive" } }
3.- I've modified the file CProject.json in /var/www/html/crm/custom/Espo/Custom/Resources/metadata/clientDefs adding the filters name.
Code:
"filterList": [ { "name": "Activos" }, { "name": "Inactivos" } ],
Thank you for your help
Comment