Get id of Current Record in its related module's Subpanel lookup

I am working on:
Version 7.11.6
Sugar Version 6.5.25 (Build 344)

I have many to many relationship between Contacts & Custom Module (AD_Address). When I open DetailView of a Contact, Address Subpanel shown below.
In that subpanel, when I clicked Select button, a lookup window will open, where search fields and list of Addresses are given.

I need to get id of current record (Contact) in that lookup field. I am looking in following file but got no help :

What I want to achieve?

  1. I have account associated with Contact. Account also have many-many relationship with Address.
  2. When someone try to attach an Address to Contact, then in the lookup search, only those Addresses will shown which are associated with Contact’s Account.

This is something called “initial_filter”

you can search Forums for how to add an initial filter to Popup defs. E.g.

I think you didn’t understand my scenario.

I have 3 modules. Accounts, Contacts, AD_Addresses.

Many-2-Many Relationship between => 1. Account-AD_Addresses, 2. Contacts-AD_Addresses.

Suppose Address module having 10 addresses but
an account X having 10 Addresses attached. A contact Y having account X as parent.
In detail view of contact Y, we have subpanel of addresses.
I want to attach some addresses to that contact Y. When I press “Select” to attach addresses to contact Y, It must show only 10 addresses which are associated with its parent account X.