function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Preetham 345 SFDCPreetham 345 SFDC 

Implementation of Satus Bar or Progress Bar

Hello Every One,
I am trying to implement a bulk upload process for my client  by uploading a  csv file and Database.Insert class at the backend on the controller side.At the front end in the UI i am showing the user a visual Force page of data tabel(reading the data) which consits of data in csv file. Now I succeded till  insertion of all the records into saleforce which in csv file. Now i am in a plan to implement a 'Progress Bar' or 'Status Bar' which will pop up when user will click on Insert button and will update its status as per records get inserted(simillarly like status bar in data loader). If any one had worked on this kind of scenario , Could you please provide me a link or sample code so that would be easy for me  to implement it.

Thanks in Advance    
Well you can easily add an action status to a action but that will be a static message or Gif image without any status information. I did some work around this and you can find the same here

ow if you want something to show numbers you probably have to read csv file using JS and chunkify the file. Now send the records using remoting and update the status in progressbar.
Preetham 345 SFDCPreetham 345 SFDC
Hi Avidev,
Thank's for your quick reply, how can we differentiate the records whether it is succes Insertor failure Insert using JavaScript.If possible can you provide some infromation on it . That will be very helpful to all of the people like me in the community.


Javascript remoting or we can say Visualforce remoting is the solution to get status of success or failure of action performed by user on visualforce page. Look at the following example:


global with sharing class AccountRemoter {

    public String accountName { get; set; }
    public static Account account { get; set; }
    public AccountRemoter() { } // empty constructor
    global static Account getAccount(String accountName) {
        account = [SELECT Id, Name, Phone, Type, NumberOfEmployees 
                   FROM Account WHERE Name = :accountName];
        return account;

Remoting on visialforce page:

<apex:page controller="AccountRemoter">
    <script type="text/javascript">
    function getRemoteAccount(name) {
        var accountName = name;

            function(result, event){
                if (event.status) {
                   // Here is success
                } else if (event.type === 'exception') {
                    // Here is failure by your logic or custom exception
                } else {
                   // Here is failure of remote call. capture it by event.message
            {escape: true}
    <button onclick="getRemoteAccount('Burlingten Textiles')">Get Account</button>

Well that should be easy. Have you used 

earlier ?

You can have a insert method in controller and probably return the record count which succeded ?

Something like this should do

public static Integer insertAccount(List<Account> accts){
Database.SaveResult[] srList = Database.insert(accts, false);
Integer i =0;
for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
return i;

James LoghryJames Loghry
For another example of a progress bar, see tehnrd's awesome blog post: