Thursday, 22 January 2015

Fun with Progress Bars

I am sure as a Salesforce professional, you would have run into similar situations where your customers have asked you to build them something to track and monitor the progress of their tasks. One of the most common ways that I have come across to achieve this representation of information is through a progress bar, which facilitates the users with precise and accurate information and enables them to quantify the actual progress.
Here’s a catch though! As a developer, you might fall into the trap of trying to use Apex and Visualforce to accomplish this requirement. But hold on and recap what Salesforce recommends –Use clicks and not code, unless code is imperative.” 


Progress Bars needs simple Formula Fields!!!

Let me show you how you can achieve this with simple formula fields! Yes, you read that right, with mere formula fields!!!

Let’s assume that your customer wants to determine the Lead profile completeness based on the following fields. It’s a good idea to only consider those fields that would be the real game changer for Lead conversion. (Don’t forget the 3900 character limit for formula fields within Salesforce!!)
  • Phone
  • Mobile
  • Email
  • Fax
  • Title

The first step that you need to do is to write a simple formula field on Lead, that quantifies the profile completeness as a number, which is computed based on whether any of the above mentioned fields are blank or not.


Now, leverage the number computed in the earlier step to visually represent it on the progress bar by creating another formula field on Lead, as shown below.
 


Voila!  What you get is a sophisticated progress bar visually representing the profile completeness as shown below.
 

You can use the same formula across multiple scenarios. I would be including additional use cases in the next few weeks as an extension to the current post to showcase additional avenues where the same can be leveraged!! Till then, have fun trying this out!


 




 
 
 
Written by Jigar Shah, Solution Architect at Eternus Solutions

17 comments:

  1. Awesome, worked like a charm! Many thanks! -Oliver

    ReplyDelete
    Replies
    1. Thanks Anand and Oliver Hansen. I am glad I could help.

      Delete
  2. Love it! How could we use this same concept for sales stage progress? Say we have 5 stages and we want to see how an opportunity has progressed?

    ReplyDelete
    Replies
    1. Thanks Rick. You could apply the same concept to demarcate the Sales Stage progress. What you could do is quantify each Sales Stage by associating it with a numeric value. So Prospecting may be 1, Negotiating would be 2 and so on for each stage.

      Create a simple formula field (lets say Stage Completeness Qty) something very similar to Profile_Completeness_Qty field in the article above which populates the numeric value based on the current stage value. Now use the same formula from the Profile_Completeness field in the article above, by replacing Profile_Completeness_Qty__c with the Stage Completeness Qty and you should be able to recreate the same magic !!

      Delete
  3. Thank you for the post. It helped me.

    Sorry to ask, but have one question - Can you help: We are trying to have dynamic style for tab.

    For example make the Tab red in color, if that Object has any single record.

    Thank you in advance.

    ReplyDelete
    Replies
    1. I am happy that you benefited from the post.

      What are the type of tabs on which are you attempting to apply a dynamic style? - Visualforce tabs, Custom tabs or standard tabs?

      Delete
    2. Thank you, Its Custom object tab.

      Delete
    3. Mashood, in order to override the out of the box tabs you would need to use a CSS hack using javascript to accomplish the color change that you desire. But please make a note that performing a hack is not a recommended practise that Salesforce encourages!!
      You can leverage Visualforce to accomplish this and set the tabstyle attribute of the tag to set a specific tab style !!

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I'm not able to write first formula field what you have written. Pls acknowledge to my question.

    ReplyDelete
  6. Saipavan, does your Salesforce user account have the necessary permissions to access the Lead object or create a formula field? If not your system administrator should be able to help you with the same.
    If that is not the issue, can you please provide the error message that you encounter so that it would be easier to help you resolve the issue !!

    ReplyDelete
  7. I am getting an error: Error: Compiled formula is too big to execute (5,627 characters). Maximum size is 5,000 characters

    ReplyDelete
    Replies
    1. The formula I had was too complicated. I created a workflow field update with the formula and result to a number field. Changed the compiled size from 5,627 to 410.

      Delete
  8. @TomSFAdmin The formula fields can mess up sometimes if the character size is too large. Compiling the intermediate results into fields (not necessarily formula fields) and then using helps us evade through formula field character limit. Thanks for sharing and glad the formula was helpful!

    ReplyDelete