Hello, I wondered, what were the exact steps to get to prefilter the products when filling out a sales order based on the brand value.
Filter products based on a foreign entity
Collapse
X
-
-
Comment
-
Well, the easiest way is:
1. In the Product entity create 'Varchar' field type and call it for example like 'hiddenBrandName'.
2. Add Formula for the Product entity:
Code:hiddenBrandName = brandName
4. Create Product.php in espocrm/custom/Espo/Custom/SelectManagers
Add this code into it:
PHP Code:<?php
namespace Espo\Custom\SelectManagers;
class Product extends \Espo\Modules\Sales\SelectManagers\Product
{
protected function filterPhoenixolutions(&$result)
{
$result['whereClause'][] = array(
'hiddenBrandName' => 'Phoenixolutions'
);
}
}
Configure the "filterList" parameter:
Code:{ "filterList": [ "__APPEND__", { "name": "phoenixolutions" } ] }
You can also fetching brand by its id. In this way you do not need to create one more field and use Formula.Last edited by Maximus; 09-12-2019, 10:19 AM.Comment
-
You can also utilize Report Filter (if you have advanced pack). It allows adding filters to all users or users from specific team.If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.Comment
Comment