Working with a Person's Address Type

When you edit or add a new address for a person in Sage CRM you are invited to specify whether the address is a Business address or a Home address.

This choice is then shown on the address list for the person.

The default choice for address type is 'Business' or 'Home'. This information is stored in the address_link table that links the address to the person. The field is called 'adli_type'.

Because the information is stored in an intersection table Sage CRM uses a special translation technique to control the ability to select the address type on the screen.

The choices for the person address type are stored as translations. You can access these via

Administration -> Customization -> Translations

The person address types belong to the caption family 'Link_PersAddr'.

An additional address type can be provided by adding a translation record. e.g.

Capt_family: Link_PersAddr
Capt_code: Temporary
capt_us: Temporary

This extra address type will then appear on the address edit screens.

Note: When you are working with Company Addresses then the information is stored in the address_link table in the same way. The caption family for the company address types is 'Link_CompAddr'.

The translation technique is used to control phone and email addresses. This has been discussed in the article 'Email and Phone Numbers in CRM'.

The Display of Address Type on the Person Summary Screen

A contacts address information is displayed on the person summary screen. But this does not include the address type.

The address information displayed is defined in meta data as the screen (entrygroup) block 'AddressBoxShort'.

We can easily add the address type to this screen via a field's create script. This trick is going to use the Caption property of the field. The technique has been discussed before in other articles most notibly in 'How do I put calculated or derived info in a screen's top content?'

I have used a dummy field which is the same trick used in the article mentioned above.

The create script is added to the field in the screen

The code used is this


if (Values('act') == 220)

{

var intAddressId = CRM.GetContextInfo("person","pers_primaryaddressid");

var intPersonId = CRM.GetContextInfo("person","pers_personid");

Caption = intAddressId;
var myRecord = CRM.FindRecord("address_link","adli_type is not null and adli_addressid="+intAddressId+" and adli_personid = "+intPersonId);
myRecord.OrderBy = "adli_type"; 
var strAddressType ="";
while (!myRecord.eof) 
{
strAddressType += CRM.GetTrans("link_persaddr",myRecord.adli_type)+", ";
myRecord.NextRecord();
}
Caption = strAddressType;
}
else
{
Hidden = true;
}

Because the screen block 'AddressBoxShort' is used in the Company Summary page the script above makes sure the address type is only displayed in the context of the Person Summary action.

The address type is then displayed in the Person Summary screen.

Note: An address can be more than one type. e.g. Home and Business.

Anonymous