set related modules relate field value to the current modules custom relate field

Hello Everyone,

I have a requirement, to bet related modules fields and set to the current record.

I have four modules i.e. Objects, Sub-objects, Units and Projects. I have one to many relationships are:

Objects to Sub-objects module - one to many

Sub-objects to Units - one to many

Projects to Objects - one to many

I don't have direct relationship between Units to Objects module and Units to Project module.

Within Objects module, have subpanel for Sub-objects

Within Sub-objects module i have two fields:

1. Objects (Lookup)

2. Project (Custom relate field)

Within Units module, have three fields:

1. Sub-objects (Lookup) 

2. Project (Custom relate field)

3. Object (Custom relate field)

So, My question is that, when i am going to create any record for Units module. And on selection of Sub-object (lookup), How to get auto populating value to the Project and Object fields.

For ex. 

Object Module have one record named as "Test object one", with selected project (Custom relate field) is "Test Project one".

"Test object one" is linked with Sub-object module record name is "Test Sub-object one".

"Test Sub-object one" is linked with Units module record named is "Test Unit one".

 

And when I open any record from Units module named as "Test Unit one".  As per above information, here is one lookup field i.e. Sub-objects which is by default selected ("Test Sub-object one")

Now i want to auto-populate value to "Project" and "Object" field(Custom)

Project field should selected value is "Test Project one"

and 

Object field should selected value is "Test object one"

because its linked with each other.

To achieve this functionality. I have two options i.e. Dependency and Vardefs(Populate-list)

Using vardefs populate_list related objects name is displayed but only for few seconds.

Below are my vardefs file code:

$dictionary['Units_Units']['fields']['pb_part_objects_units_units_1_name']['populate_list']['obj_objects_pb_part_objects_1_name']='objects_name'; //populate SUB OBJECT module's OBJECT field to objects_c field of Unit module

$dictionary['Units_Units']['fields']['pb_part_objects_units_units_1_name']['populate_list']['obj_objects_pb_part_objects_1_id']='objects_id';

pb_part_objects is my Sub-objects module

obj_objects is my Objects module

units_units is my Unit module

 

Any one have solution for this.

Thanks in advance! Francesca Shiekh#

Parents
  • You need to create all the relationships between:

    • Project and Sub-Object
    • Project and Unit
    • Object and Unit

    After that you can setup the attribute populate_list on field link of strong entity and on field relate of the weak entity, that means

    For module Sub Object:

    Configure populate_list on field type link of Unit.

    This way, on creating an Unit from subpanel under Sub Object it will auto populate the relationship to Object and Project as well.

    For module Unit:

    Configure populate_list on field type relate of Sub Object.

    This way, on creating an Unit from the scrath and select a Sub Object it will auto populate the relationship to Object and Project as well.

    Take a look at modules/Contacts/vardefs.php for reference.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • You need to create all the relationships between:

    • Project and Sub-Object
    • Project and Unit
    • Object and Unit

    After that you can setup the attribute populate_list on field link of strong entity and on field relate of the weak entity, that means

    For module Sub Object:

    Configure populate_list on field type link of Unit.

    This way, on creating an Unit from subpanel under Sub Object it will auto populate the relationship to Object and Project as well.

    For module Unit:

    Configure populate_list on field type relate of Sub Object.

    This way, on creating an Unit from the scrath and select a Sub Object it will auto populate the relationship to Object and Project as well.

    Take a look at modules/Contacts/vardefs.php for reference.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
No Data