Cannot add relate field [relationship field] on the custom module record save/update

Hello,

Please forgive for my language and terminologies used if are incorrect

below is what I am struggling with

I have a custom module name COF

I wanted to have a relationship with opportunities 1 : M [1 Opportunity can contain many COFs]

I wanted to have a relationship with Accounts1 : M [1 Account can contain many COFs] Billing Account

I wanted to have a relationship with Accounts1 : M [1 Account can contain many COFs] Shipping Account

I wanted to have a relationship with Contacts1 : M [1 Contact can contain many COFs] Billing Contact

I wanted to have a relationship with Contacts1 : M [1 Contact can contain many COFs] Shipping Contact

I have created relationships via script

PFB below script

\custom\metadata\custom_relationships_cof.php

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$dictionary["itb_cof_billto_accounts"] = array (
'relationships' =>
array (
'itb_cof_billto_accounts' =>
array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module'=> 'itb_cof',
'rhs_table'=> 'itb_cof',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'true_relationship_type' => 'one-to-many',
'join_table' => 'itb_cof_accounts',
'join_key_lhs' => 'account_id',
'join_key_rhs' => 'itb_cof_id',
'relationship_role_column' => 'account_role',
'relationship_role_column_value' => 'Bill To',
),
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

\custom\Extension\application\Ext\TableDictionary\custom_relationships_cof.php

Fullscreen
1
2
3
<?php
include('custom/metadata/custom_relationships_cof.php');
?>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

After doing QRR it prompted for create table in the query box after comparing the vardefs

I executed the code and the fields got created verified the relationship tables are present in the database.

Now I have created a relate fields in the COF module as below

\custom\Extension\modules\itb_cof\Ext\Vardefs\COF_Fields.php

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$dictionary["itb_cof"]["fields"]["shipping_account_name"] = array(
'name' => 'shipping_account_name',
'rname' => 'name',
'id_name' => 'shipping_account_id',
'vname' => 'LBL_SHIPPING_ACCOUNT_NAME',
'type' => 'relate',
'table' => 'shipping_accounts',
'isnull' => 'true',
'link' => 'shipping_accounts',
'module' => 'Accounts',
'source' => 'non-db',
'populate_list' =>
array (
'shipping_address_street' => 'shipping_address_street',
'shipping_address_city' => 'shipping_address_city',
'shipping_address_state' => 'shipping_address_state',
'shipping_address_postalcode' => 'shipping_address_postalcode',
'shipping_address_country' => 'shipping_address_country',
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

After that I did a quick repair and rebuild

Then in studio I have placed the fields into the record view of COF module

when I related the account, contact, opportunity  record into the relate field on record view of COF module

When I try to create COF record or edit any existing COF record all the other values gets save but these related field value does not get save

I also checked into the respective database relationship table there is no entry. 

can anyone point me out what I am missing here ? or where did I go wrong ?