How to Add a Client Script Progress Bar

Hi, does anyone have any tips on how to add a progress bar to a client script? Basically, when a button is clicked on the form, it triggers code that takes a while. I just need a progress bar to indicate the script is still running. It doesn’t even need to show an exact percentage of completion, just something to show it’s running.

Beginner Asked on September 23, 2019 in SuiteScript.
Add Comment
3 Answer(s)

Hi @Luci4, Please help this one.

This is possible, we created loading page and percentage of completion for a custom process in sales order.

Thank you!


Beginner Answered on September 23, 2019.
Add Comment

It is doable via DOM manipulation by adding some css elements on page load via client script which is ready to execute upon button clicked or something. Make sure that you run it asynchronously for some reason that browser will freeze when processing large data.

Beginner Answered on September 24, 2019.
Add Comment

I like the javascript approach. Use your favored javascript library to show a progress bar / loader. Since I still had it setup in a test account , here is an example using Sweet Alert 2 ( Sweet Alert 2 isn’t a progress bar library, but it can be abused to do so.

 * @NApiVersion 2.x
define(["./sweetalert2.all.js", "N/https"], function(Swal, https) {
  return {
    button: function() {{
        onBeforeOpen: Swal.showLoading,
        onOpen: function() {
              function() {
              function() {
                Swal.update({ type: "error", text: "An error occured" });
        allowOutsideClick: false,
        allowEscapeKey: true,
        text: "I'm busy"

I added the above as a button function’s code using a beforeLoad user event script to avoid NetSuite trying to run sweetalert2 serverside.

Advanced Answered on September 24, 2019.

Thanks for the example!

on September 24, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor