Automatically setting the filter when selecting entity records
Collapse
X
-
yuri Kharg i misunderstood "reportFilterXXXXXXXXX". and replaced the "reportFilter" portion. The "reportFilter" part is a constant. The "XXXXXXX" is the variable part which is to be replaced with the filter ID obtained from the Browser URL when viewing the report filter. Corrected the mistake and it is working great now. Thank you for all the help.Last edited by murugappan; 03-04-2024, 01:16 PM. -
"reportFilterXXXXXXXX". Case matters ALWAYS. I'm baling out. Need to work. -
-
yuri Kharg
Very interesting as I got it work partially but the result came with an error. Please allow me to follow through the steps again (because i made a few mistake earlier):
(1) Setup relationship between Company Notification entity and Company entity
(2) I created a list report "FilterInsurer" which contains the filter
(3) I created a Report Filter "FilterInsurer"
(4) I define the Primary filter in the Company Notifications entity
(5) I go the front end and create a Company Notification and select a company (which should give me a list "insurer")
(Continued on next post)
Last edited by murugappan; 03-04-2024, 08:49 AM.Leave a comment:
-
1. The name should be "reportFilterXXXXXXXXXXXXXX", where XXXXXXXXXXXXXX is an ID of the Report Filter record.
2. For your case, If you need the filter to be applied for the link field, you need to define it in the opposite entity type ('CompanyNotification').Leave a comment:
-
F̶i̶l̶t̶e̶r̶I̶n̶s̶u̶r̶e̶r̶XXXXXXXX -- wrong. It's not how I described.
-
When you create a Report Filter, a primary filter with a name "reportFilterXXXXXXXXXXXXXX" is created, where the X part should be replaced with an ID of the Report Filter record (can be obtained from the browser's location bar).
So I think that you have to add the ID as well, such as "FilterInsurerXXXXXXXX" -
yuri
I tried the option of using the report filter but it did not work. I must have done something wrong: This is what i did:
The metadata definition is in the Company Notification entity.
Leave a comment:
-
You can specify a primary filter through metadata: https://docs.espocrm.com/development...tionshippanels, selectPrimaryFilterName. No coding needed.
custom/Espo/Custom/Resources/metadata/clientDefs/YourEntityType.json
Code:{ "relationshipPanels": { "yourLinkName": { "selectPrimaryFilterName": "myFilterName" } } }
When you create a Report Filter, a primary filter with a name "reportFilterXXXXXXXXXXXXXX" is created, where the X part should be replaced with an ID of the Report Filter record (can be obtained from the browser's location bar).
This method is 99% future proof.Last edited by yuri; 03-03-2024, 04:06 PM.Leave a comment:
-
The method is official and is supposed to be compatible in future.
> That way it becomes flexible, consistent and ensures maintainability.
This is not a magic. The flexibility and consistency would be an additional work imposed on me.Leave a comment:
-
yuri thank you for the update and the reference link.
Unfortunately, it may not work for us. Reason is the coding required and the fear of failure on version upgrades which may not be compatible to these codes. We would like to keep things simple and conform to the standard of Espocrm thereby avoiding any upgrade issues. We are already facing this issue with some of the extensions which we purchased. It catches us by surprise when we upgrade and the system crashes during our development for new requirements. We had to drop these extensions in our currenr re-engineering project to avoid delays. Everything comes to a halt until we get a fix which we could not afford.
Suggestion:
Our suggestion would be to make filter options available in relationships or in the custom list layout for relationship. That way it becomes flexible, consistent and ensures maintainability.Leave a comment:
-
Hi,
It requires a little bit of coding. See a related topic: https://forum.espocrm.com/forum/deve...current-record.Leave a comment:
-
Automatically setting the filter when selecting entity records
Hi,
This is our scenario:
Entities in CRM
-----------------------------
(1) Account: We have 2 types of accounts - Corporate and Insurers
(2) The Type field in account indicates the type of account
(3) The same company can be an insurer and a corporate (created as 2 records)
(2) Policy: Containing insurance info and has a many-to-one relationship with Account.
What we need to do:
------------------------
When we create a Policy we need to select the related insurer in Account which has the account.type field as "Insurer"
Current Scenario:
---------------------
When creating the Policy, the staff select the account they get a list of all the accounts (mixed corporate and insurer). They then have to apply a filter to show only the insurer type accounts and select.
Problem definition:
-----------------------
When selecting the account. the staff inadvertently select the the corporate type instead of the insurer type.
Resolution required:
----------------------------
Is there a way (formula or otherwise) where we could set the filter on the type when selecting the account instead of manually setting the filter. Benefit: reduction of errors by 50%.
Any help/advise is most appreciated.Last edited by murugappan; 03-03-2024, 03:44 AM.
Leave a comment: