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.
Announcement
Collapse
No announcement yet.
Filter products based on a foreign entity
Collapse
X
-
- Likes 1
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.
Comment
Comment