Wait until operation has completed inside a service portal widget

Michele11
Tera Contributor

Hi,

 

I am developing a service portal form that allows users to download table data as an excel file by clicking on a button

Michele11_0-1665655628457.png

 

To achieve this I call (by script inside a service portal widget) the built-in table functionality that allows to download table data as a document. 

To be precise I use "window.location.href" and then add the details and query for the table data.

The built-in functionality that I am referring to is the one in the below picture:

Michele11_1-1665655724551.png

 

My issue is that it takes a fairly long-time for all the data to be downloaded (up to 20 seconds). During that time everything in the service portal page is frozen, but there is no indication of that to the end-user.

I would like to add a visual cue that an operation is ongoing, but I can't figure out how to catch when the file download is completed inside the widget script, in order to then remove the visual cue.

Do you know is there is any way to accomplish this?

 

Thank you

 

1 REPLY 1

Pius Gumo1
Tera Expert

In terms if your specific implementation,

  • If you would like the download to be non-blocking, use a script include + Glide Ajax
  • On the widget being clicked, set the loading indicator.
    • Could be another loading widget set visible
    • Could be Bootstrap with a rotating Icon / Graphic
  • On the response being received from Glide Ajax stop the loading icon
    • Could be hiding the loading widget.
    • Could be hiding the icon.
    • Could be hiding a flag that shows the loading icon.

From an architectural point of view, I would not recommend what you're doing. Off the top of my head reasons:

Security and Roles + ACLs, not easily debug-able, not easily reportable 

 

How I would have done it (noting you already have a Service Portal configured) is a catalog item that triggers a Workflow / Flow that has a script to generate the attachment and sends the attachment via email / sends the attachment link.