[SalesForce] Progress Bar Per Object and Status

Wondering if you can guide me a way to show a progress bar on my VF Page or a separate VF page. What's the best way to approach it and possibly a simple startup code for me to work on?

Scenario:

I have 4 objects with statuses on each object. If the record has moved to the next object I would like a progress bar and status info to show on top of the progress bar. Primarily, I would like to have a progress bar first then add the status.

An example of the progress bar:

Progress Bar

Best Answer

I have worked on this requirement few days back, although the Ui was a little different. Hope this will help you.

Have the following CSS to style your status nodes.

<style>
    * {
        box-sizing: border-box;
    }

    #progress {
        padding: 0;
        list-style-type: none;
        font-family: arial;
        font-size: 12px;
        clear: both;
        line-height: 1em;
        margin: 0 -1px;
        text-align: center;
    }

    #progress li {
        float: left;
        padding: 10px 30px 10px 40px;
        background: #E6E6E6;
        color: #fff;
        position: relative;
        border-top: 1px solid #E6E6E6;
        border-bottom: 1px solid #E6E6E6;
        width: 18%;
        margin: 0 1px;
    }

    #progress li:before {
        content: '';
        border-left: 16px solid #E6E6E6;
        border-top: 16px solid transparent;
        border-bottom: 16px solid transparent;
        position: absolute;
        top: 0;
        left: 0;

    }
    #progress li:after {
        content: '';
        border-left: 16px solid #E6E6E6;
        border-top: 16px solid transparent;
        border-bottom: 16px solid transparent;
        position: absolute;
        top: 0;
        left: 100%;
        z-index: 20;
    }

    #progress li.active {
        background: orange;
    }

    #progress li.active:after {
        border-left-color: orange;
    }

    #progress li.done {
        background: green;
    }

    #progress li.done:after {
        border-left-color: green;
    }
    </style>

Have an outputPanel and inside that an un-ordered list to show all your status with conditional styling. Basically just check the status of your current record and apply style done for the ones already past and active for the one which is currently the status.

<apex:outputPanel id="statusPanelId">
        <ul id="progress">
            <li class="{!IF(Change__c.Status__c == 'Created','active', 'done')}">Created</li>
            <li class="{!IF(Change__c.Status__c == 'Status2','active', IF(OR(Change__c.Status__c == 'Status3',Change__c.Status__c == 'Approved'), 'done', ''))}">Status2</li>
            <li class="{!IF(Change__c.Status__c == 'Status3','active', IF(Change__c.Status__c == 'Approved', 'done', ''))}">Status3</li>
            <li class="{!IF(Change__c.Status__c == 'Approved','active', '')}">Approved</li>
        </ul>
    </apex:outputPanel>

This worked pretty well for me. You can of course redesign the CSS as per your need.

I have referred a blog from the internet which I am unable to find now. I will try to search it and put a reference. Credit should be given to the original author.

Related Topic