Is it possible to show a progress bar for onSubmit catalog client script ?

String
Kilo Sage

Hi Team ,

We are using the below code onSubmit for catalog portal item .

when use click on add button for MVRS ,we are trying to execute the below code to show progress ,but not working 

function onSubmit() {

 

    var loadingDialog = new GlideDialogWindow('loading_message', true);

   loadingDialog.setTitle('Please wait );

    loadingDialog.setSize(400, 200);

    loadingDialog.render();

 

    var orderval = g_form.getValue('u_order');

 

    // Call script include

   var ga = new GlideAjax('Customer); // Script include

    ga.addParam('sysparm_name', 'count'); // Method

     ga.addParam('order', orderval);

  

  ga.getXML(getResponse.bind({

        dialog: loadingDialog

    }));

    }

 

function getResponse(answer) {

    var answer1 = answer;

    g_form.setValue('qty', answer1);

    this.dialog.destroy();

}

Please guide me with best practices 

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

Your catalog submission should not take long enough for you to show a progress bar. How long does this take you that you need to do this?

Also GlideAjax doesn't work very well with OnSubmit scripts.

 

-Anurag

Hi @Anurag Tripathi ,thanks for your quick response 

When input is added to Field A and the ADD button is clicked, it initiates a process where business logic is executed to assign a value to the 'qty' field via GlideAjax. Since GlideAjax operation may take some time to complete, we're contemplating the inclusion of a progress bar to enhance user visibility during this process. While we recognize that this approach is standard, considering our current project phase, we're compelled to adopt it. Could you please provide guidance on implementing a progress bar for the GlideAjax Onsubmit 

In this case , if you expect it to take a long time, lets say 20-30 seconds then my advise is to try and get that transaction run Async and separate it out form the Submission process of the catalog item. 

Catalog submission should be swift, they are not made to have this functionality.

-Anurag