RE: 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.

mmascitto Beginner Asked on September 23, 2019 in SuiteScript.
Add Comment
3 Answers

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.