Relationship value visibility depends on another selection of a relationship value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Marcel
    Junior Member
    • Jul 2025
    • 18

    #1

    Relationship value visibility depends on another selection of a relationship value?

    Hi all,

    I have 3 Entities:

    1. CContract (Many-to-One relation to CProductLine and CContractType)
    2. CProductLine (One-to-Many relation to CContractType)
    3. CContractType

    I am in the Layout of the CContract Entity and when I am selecting a CProductLine (e.g. Insurances) under CContractType every ContractType that is related to the selected ProductLine should be selectable in the dropdown list. Is that possible? So based on the selected ProductLine the values under ContractType are filtered/visible.

    Click image for larger version

Name:	image.png
Views:	2
Size:	30.6 KB
ID:	119985

    I read something about a select-handlers and created the following.

    /.../client/custom/src/handlers/select-related/contract-type-by-product-line.js

    PHP Code:
    define('custom:handlers/select-related/contract-type-by-product-line', ['handler'], function (Dep) {

        return 
    Dep.extend({

            
    filterData: function () {
                const 
    productLineId this.model.get('productLineId');

                if (!
    productLineId) {
                    return 
    null;
                }

                return [
                    {
                        
    type'equals',
                        
    field'productLineId',
                        
    valueproductLineId
                    
    }
                ];
            }

        });
    });
    ​ 
    But that does not seem to work.

    Thanks!
Working...