In the last post we discusses about customizing Name composite field, in this post we would discuss about Address composite field. Unlike Name composite control, Address is actually an entity in the system. The address composite control is built based on the Address entity.
Address composite control is build of Street, City, State/Province, Postal Code and Country fields.
However unlike Name composite control, the constituent fields of Address composite controls cannot be renamed from the UI. The constituent fields of the Address composite control do not appear to use the field display names, and instead appear to be hard-coded into the composite control.
The Address composite control is ONLY available for Account, Contact, Lead, Competitor, Quote, Order, and Invoice; but not available for User, Business Unit, and Site entities.
Now we would explore the customization options of the Address flyout.
How to set the value of a field inside the fly-out menu?
For example, how do we default to Country to always Australia. We can do this by using a Business Rule.
The other way to achieve the same behavior is by adding the following Java Script code:
N.B. : When both Business Rule and Java Script is added to modify the same field, the Business Rule wins! For example, if we add a Business Rule to default the Country to “Australia” and a Java Script to default it to “USA”, the user would find the Country value to be “Australia”.
How to hide fields in the fly-out menu?
Sometimes, we want to hide a field from the address flyout like State/Province. For example, countries like UK or New Zealand does not usually use State/Province in their address.
To achieve the same result using a Java Script, use the following script:
How to make a field Business Required in address fly-out menu?
Making some address fields mandatory is a normal business need. Let us here try to make Street1, City, ZIP/Postal Code and Country/Region field Business Required. Making the fields Business Required would make them mandatory in the Address flyout as well.
However, we can make a field Business Required using the following Java Script code as well:
How to change the label of fields in the fly-out menu?
The address fields however cannot be changed through the UI. These do not to use the field display names, and instead appear to be hard-coded into the composite control. There is no supported way to change the labels of the fields. The supported control.setLabel() Java Script API does not work as we cannot get the control of the field inside the fly-out menu.