
If you’re doing some sort of operation where you’d like to display progress to the user, you can use the showProgessBar function in Sage.UI.Dialogs. You’ve likely seen this progress dialog before, such as when you’ve run a report in CRM. You can use that same dialog for your needs as well. There’s two ways to use the progress dialog, for a set/determined number of items, or for an indeterminate or unknown number of items.
The params for showProgressBar are passed as an object. The object can have the following properties:
- title: Title of the dialog
- message: (optional) Message to display on the dialog
- showmessage: true/false
- maximum: the max number of items (not needed if setting indeterminate=true)
- pct: the percentage for the progress (not needed if setting indeterminate=true)
- indeterminate: true/false
- height: (optional)
- width: (optional)
Showing for an Indeterminate Number of Items
If you don’t know how many “things” you’ll be showing progress for, you can just display it for an indeterminate count.
The code looks like this:
Sage.UI.Dialogs.showProgressBar({indeterminate: true, title: 'Test Progress', message: 'Doing something...', showmessage: true});
The progress dialog for indeterminate looks like this:
Then, to close the progress dialog when you’re done, you’d call closeProgressBar, like this:
Sage.UI.Dialogs.closeProgressBar();
Showing for a Determined Number of Items
If you do know the number of “things” to show progress for, you will call showProgressDialog for each update of the percentage. For example, start with this:
// set at zero percent (pct) Sage.UI.Dialogs.showProgressBar({maximum: 100, pct: 0, title: 'Test Progress', message: 'Doing something...', showmessage: true});
That will display the following:
Now, each time you want to update the progress, you simply call that again, but this time with an updated pct (or percentage) value:
// set at 60 percent (pct) Sage.UI.Dialogs.showProgressBar({maximum: 100, pct: 60, title: 'Test Progress', message: 'Doing something...', showmessage: true});
The progress will be updated:
You keep calling that as many times as you need, updating the progress (pct). When you’re done, you close it with the following:
Sage.UI.Dialogs.closeProgressBar();
That it, and you’ve ended up with a much nicer user experience. Keep in mind, this just works for client-side operations, such as doing things via SData, as I’ve mentioned previously.
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!