Multiple display logics of a field not working #563
Labels
Priority:Important
Issues & PRs that are important; broken functions; errors; there are workarounds
Severity: Moderate
Minor Impact
Status: Fix Proposed
A issue that has a PR related to it that provides a possible resolution
Type: Bug
Something isn't working
Issue
When a user configures multiple display logics for a field, currently it is not working properly.
For example, if we have set 2 display logics for a field 'status' under 'Lead' module such as follows:
'status' field should be shown when 'title' field value is 'Converted' and should be hidden when 'title' field value is 'Dead'
However, the field is currently not being shown when the value is 'Converted' and it turns out that whenever any display logic condition holds, the field will always be hidden.
Possible Fix
I've found 2 problems in how we set "field.display" value in runAll() of 'FieldLogicDisplayManager' class
P1.
As we can see in the above, the targetDisplay does not reflect the value we set in displayLogic['params']['targetDisplayType']
P2.
Also, when there are multiple displayLogics for a field, according to the CRM official documentation, all these displayLogics will be applied as 'OR' condition.
For example, when displayLogic A is 'active'(which means the display logic condition holds), the displayLogic A's 'targetDisplayType' should be applied. Also, when displayLogic B is also 'active', the displayLogic B's 'targetDisplayType' should be applied too. My current fix is currently take the last specified displayLogic's targetDisplayType since there can be a conflict for deciding the value.
The current codebase does not handle the case where there can be multiple displayLogics for a field in terms of deciding targetDisplay.
So, I rewrote runAll() of FieldLogicDisplayManager to tackle aforementioned 2 problems as follows:
Steps to Reproduce the Issue
For example, in the above case, 'status' field should be shown when 'title' field value is 'Converted' and should be hidden when 'title' field value is 'Dead'
The text was updated successfully, but these errors were encountered: