Pages

Wednesday, July 27, 2011

Logic Hooks: Truncating Displayed Values

Sometimes minor customizations to SugarCRM go a long way towards addressing important usability aspects. Something that has come up a couple of times in recent interactions with users is the need to truncate data displayed on a subpanel.


At first glance, the reasons why someone would want to do this are not always readily apparent. However, consider the scenario where one uses a text area field (e.g. description) on a module and one wishes to display that field on the subpanel.


The process of including the field on the subpanel is easily accomplished via Studio, but over time, an issue not initially apparent usually starts to surface.


Because a text area field can hold large amounts of text, it is possible for a user to populate the field with a number of pages worth of data. That on its own is not a problem. However, displaying that on a ListView, of which a subpanel is a good example, usually causes undesired display problems, as demonstrated by the image that follows (click to enlarge):




The issue at hand is that the Description field with the longer text value makes the subpanel appear a bit odd, to the point that the additional columns that are part of the view appear to the extreme right of the screen.


So how do we solve this? Easily, via a logic hook. Let us take a look at how we do so.