Guidance on auto populating values via Relate To/Relationships

There are two modules: Module A and Module B.

In Module B, from a functional perspective, we need to relate a field to Module A and auto-populate a few field values from Module A based on the record selected from the lookup.

Relate To: Using a formula, we can't auto-populate values.

To achieve the above, we need to create a relationship.

  • 1:1 Relationship: The downside is that a new table is introduced, which increases the volume of data. If we need to write a query, the number of joins will also increase.
  • 1:M Relationship: Similar to the 1:1 relationship, a new table is introduced, increasing data volume and joins in queries. Additionally, from a functional perspective, we don't need a subpanel, but it would still need to be hidden via Studio or JavaScript.

Could you please guide us on the correct approach? Should we add a 'Relate To' field and auto-populate values via code, or should we add relationship fields, considering their drawbacks? This is a very common scenario, so any insights would be appreciated.

Parents
  • Hi ,

    I'm sure you have your reason but I remember in a custom code I was tackling, I was auto populating Module A's field into the view of Module B. 

    Could you give a try this following in your metadata (potentially record.php)

    [
        "name" => "field_of_module_b",
        "type" => "relate",
        "label" => "LBL_FIELD_OF_MODULE_B",
        'auto_populate' => true,
        'related_fields' => [
            "field_of_modul_a",
        ],
        "populate_list" => [
            "field_of_modul_a" => "another_field_of_module_b"
        ]
    ],


    Let me see if that helps. 

    Tevfik Tümer
    Sr. Developer Support Engineer 

Reply
  • Hi ,

    I'm sure you have your reason but I remember in a custom code I was tackling, I was auto populating Module A's field into the view of Module B. 

    Could you give a try this following in your metadata (potentially record.php)

    [
        "name" => "field_of_module_b",
        "type" => "relate",
        "label" => "LBL_FIELD_OF_MODULE_B",
        'auto_populate' => true,
        'related_fields' => [
            "field_of_modul_a",
        ],
        "populate_list" => [
            "field_of_modul_a" => "another_field_of_module_b"
        ]
    ],


    Let me see if that helps. 

    Tevfik Tümer
    Sr. Developer Support Engineer 

Children
No Data