Wednesday 3 April 2013


Last Activity Bar Graph: Using IMAGE() to Provide More Information

I talked about IMAGE() formula fields and hidden Salesforce images in my last post. In additional to the standard IMAGE() functionality for displaying certain images at certain times, we can also make use of the width and height of the image to provide additional information. Let us imagine that we want to show a horizontal bar graph of the number of days it has been since there has been an Activity on this Account. Try something like this:
/* future */
IF(Last_Activity_Date__c > TODAY(), IMAGE("/img/samples/flag_green.gif", "Future Activity"),
/* none */
IF(ISBLANK(Last_Activity_Date__c), IMAGE("/img/samples/rating3.gif", "No Activity"), 
/* more than 90 */
IF(TODAY()-Last_Activity_Date__c >= 90, IMAGE("/img/samples/rating5.gif", "More Than 90 Days"), 
/* bar graph */
IMAGE("/img/samples/color_red.gif", TEXT(TODAY()-Last_Activity_Date__c) & " Days", 14, 
  TODAY()-Last_Activity_Date__c))))
There are four possible states for this formula:
  1. Future: There is future activity planned. In this case, a green flag is shown.

  2. None: No activity has ever happened for this Account. In this case, an empty black circle is shown.

  3. Bar Graph: A bar equal in length to the number of days since the last activity is shown, up to 90 days. This bar grows, day by day, until 90 days is reached.
  4. More Than 90 Days: No activity has occurred for this Account in the past 90 days, after some activity having occurred at some point in the past. In this case, a filled black circle is shown.
Categories:

0 comments:

Post a Comment

    Links