in Search

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

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.

Comments

No Comments

About Jeff Richards

As the Head of Training Program Development for Sage Technologies, I am responsible for providing the technical education for the Sage CRM Development Partner community. I write and present regularly on Sage CRM development techniques, hints and tips. I also provide education and training for the staff of local Sage companies in new technical features and act as a resource for Sage trainers as they develop their training courses. I have been working with Sage CRM since early 2001 (version 2.85) and I have a thorough understanding of the issues faced by partners carrying out implementations. I have been working within the Software Industry since 1993. I have a strong background in Business Rules and Workflow.

News

To help you find information quickly, use the tag cloud on the righthand side of the page. Every article and file posted is marked with one or more tags. The tags are mainly single words and are listed alphabetically. The more frequently a tag has been used to mark an article the bigger it will appear in the cloud. The tags are hyperlinks that lead to a collection of items that are associated with a tag. To find an article that discusses creating XML feeds using ASP pages, click on ASP, then on the next page click on XML.

This Blog

Syndication

sagecrm.com Articles