Skip to content

Conversation

@xkrdudrlf
Copy link
Contributor

Description

This PR will close #563

  • use ['params']['targetDisplayType'] of display logic for setting targetDisplay
  • handle the case where there are multiple display logics in terms of deciding targetDisplay value for field.display eventually.

Motivation and Context

Currently, "field.display" value is always set to 'none' if any of display mode logic holds(or 'active') no matter what is set in 'targetDisplayType' for the display mode logic.
Also, it does not handle a scenario where there are multiple display mode logics for a field.

How To Test This

  1. Try setting multiple displayLogics for any field as follows:
$dictionary['Lead']['fields']['status']['displayLogic'] = [
    'readonly_when_converted' => [
        'key' => 'displayType',
        'modes' => ['edit'],
        'params' => [
            'fieldDependencies' => [
                'title'
            ],
            'targetDisplayType' => 'show',
            'activeOnFields' =>  [
                'title' => [ 'Converted' ]
            ]
        ]
    ],
    'readonly_when_dead' => [
        'key' => 'displayType',
        'modes' => ['edit'],
        'params' => [
            'fieldDependencies' => [
                'title'
            ],
            'targetDisplayType' => 'none',
            'activeOnFields' =>  [
                'title' => [ 'Dead' ]
            ]
        ] 
    ]
];
  1. Test whether a field is shown correctly in the page according to the display type set in displayLogics
    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'

Types of changes

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • [ x ] My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • [ x ] I have read the How to Contribute guidelines.

 - use ['params']['targetDisplayType'] of display logic for setting targetDisplay
 - handle the case where there are multiple display logics in terms of deciding targetDisplay value for field.display eventually.
@mattlorimer mattlorimer added the PR 4-8 Complexity Score given to PRs once assessed label Jun 18, 2025
@clemente-raposo
Copy link
Contributor

Hi @xkrdudrlf,

There might be a misunderstanding here.

The 'displayLogic', works differently from the displayType on 'logic'.

All the entries on the array work like and AND. The defaultDisplay display type is what will decide if by default the field should show or hide.

After defining the defaultDisplay the the entries on displayLogic need to be defined in a way where they all work together. Otherwise you could get conflicting conditions.

Any thoughts on this?

@clemente-raposo clemente-raposo added Type:Discussion Issues & PRs related to ongoing discussions Status:Requires Updates Issues & PRs which requires input or update from the author labels Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR 4-8 Complexity Score given to PRs once assessed Status:Requires Updates Issues & PRs which requires input or update from the author Type:Discussion Issues & PRs related to ongoing discussions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple display logics of a field not working

3 participants