How Address, Company Person links are stored

By | November 30, 2013

As you know, SageCRM supports multiple addresses to be created against the Company, Person records. We can also select address types etc. However whenever you want to create these records from COM/DOTNET API, first question comes to mind is how to store these values.
The New Stuff: Change Default dedupe behaviour
Let us consider New company screen for better understanding.

Img1

When we save these details, Address details don’t go into Company table, rather they are saved in Address table. Their relationship/linking are present in “Address_Link” table. So in order to link Company with Address, you need to first create record in Address table and then create a link in “Address_Link” table.
As you can see below, there is a section called “Type” in Address panel which contains “Check Boxes” under it. Now I will explain you how entries are created in “Address_Link” table based on above “Check Boxes”. Let’s understand it one by one

Img2_1

 Case 1:- When nothing is selected from available check boxes. Please refer below screen which explains how data is stored in “Company” ,”Address” and “Address Link” table .

DATA IN COMPANY TABLE:-Img4
DATA IN ADDRESS TABLE:-Img5
DATA IN ADDRESS LINK TABLE:-Img6
Case 2:-When only “Business” type is selected.

DATA IN COMPANY TABLE:-Img7

DATA IN ADDRESS TABLE:-Img8

DATA IN ADDRESS LINK TABLE:-Img9

Case 3:-When only “Billing” type is selected.

DATA IN COMPANY TABLE:-Img10

DATA IN ADDRESS TABLE:-Img11

DATA IN ADDRESS LINK TABLE:-Img12

Case 4:-When only “Shipping” type is selected.

DATA IN COMPANY TABLE:-Img13

DATA IN ADDRESS TABLE:- Img14

DATA IN ADDRESS LINK TABLE:-Img15

Case 5:-When “Business” and “Billing” type is selected.

DATA IN COMPANY TABLE:-Img16

DATA IN ADDRESS TABLE:-Img17

DATA IN ADDRESS LINK TABLE:-Img18

Case 6:-When “Business” and “Shipping” type is selected.

DATA IN COMPANY TABLE:-Img19

DATA IN ADDRESS TABLE:-Img20

DATA IN ADDRESS LINK TABLE:- Img21

Case 7:-When “Billing” and “Shipping” type is selected.

DATA IN COMPANY TABLE:-Img22

DATA IN ADDRESS TABLE:-Img23

DATA IN ADDRESS LINK TABLE:-img24

Case 8:-When “Business”, “Billing” and “Shipping” type is selected.

DATA IN COMPANY TABLE:-Img25

DATA IN ADDRESS TABLE:-Img26

DATA IN ADDRESS LINK TABLE:-Img27

You can see throughout the above explanation that 2 records are created in Address_Link table. One entry has only company id and another has Company Id as well as Person Id. You need to write your API methods in such way that you create similar entries in tables as explained above, so that the functionality of SageCRM is not broken in any scenario.
Also Read:
1) Hide Type field in Address panel of Sage CRM
2) How to add the Mobile Phone and Private Phone fields to the views being used by Find screens, Reports and Groups
3) How the address is arranged over multiple lines?
4) 3 Easy Steps to Add Sage CRM Custom Entity in Advanced Find
5) Create Document Template in Sage CRM 7.1 SP2 and SageCRM 7.2