Created Background Proses
Question

Dear Team

How do I create a process background after the user generates a file from the list to the table that I have created? so the user doesn't have to wait on the screen

After i click  button generate to xls

and how to use the logic below?




Hi,

Demo: https://nsahinbay.outsystemscloud.com/DownloadInBackgroundDemo/

You can trigger download on the home page and wait or navigate another screen. The download will be started in 10 seconds. I implemented a token validation in the REST APIs but it can be extended because I am not satisfied fully. As you know that it is a demo and it may have some issues. Please be careful before using it in a real case if you would like to implement it in your application.

I had had to use Rest API with a simple token authentication because OutSystems is giving a security error when Javascript timers call server action after navigating to another screen. I didn't want to challenge with this error. I exposed two REST APIs in the same module and implemented XMLHttpRequest in Javascript quickly.

Please check the demo with oml file and let me know if you have questions.

Sincerely,
Necmettin

DownloadInBackgroundDemo.oml

Hi @Hothorasman Panjaitan,

With automatic activity in the process, you can run the server action in background.

But you cannot download the file. Due to security reasons, the download will not work in automatic activity.

Hope this will helps

Thanks, Aadhavan S

Hi Hothorasman,

You have some options that explained in documents: https://www.outsystems.com/training/courses/176/asynchronous-processes-in-outsystems/

You can choose the best option depends on your work.

Best regards,
Necmettin


Hi,

This is course url. Can you let us know where is download option in explained in process?

That will be helpful to the community members.

Hi,

You can learn best practices in the course.

Processes and timers are working in the background. So, you can not interact with user on processes and timers. You can run your logic and make your file ready to download. You can store file in the db (or in a storage), then you allow user to download after file is ready to download. In this case, the point is about UX. User should refresh page to check if file is ready or not. In an advanced scenario, you can implement Websocket solution to make user experience better.

I hope it is clear for you.

Sincerely,
Necmettin

But the question is different. query is How to download the file in background (may using process)


App should have JavaScript timer which checks file is ready. When file is ready, add  JavaScript code that triggers download action.

In traditional Web application, JavaScript timer will be end when user navigates to another page. But in reactive or mobile apps, JavaScript timers will work till user close browser tab.

Another point is that JavaScript timer should be stopped to avoid unnecessary working.

This implementation requires good JavaScript knowledge.

Best regards,
Necmettin

Yes now you are navigating questioner to the right direction 👍🏼

Sorry for missing the point. I am happy to hear that it is clear now.

Sincerely,
Necmettin

Dear  Necmettin Sahinbay  

Thanks For your atention, can you give an example? in the form of .oml file?



Hi,

Demo: https://nsahinbay.outsystemscloud.com/DownloadInBackgroundDemo/

You can trigger download on the home page and wait or navigate another screen. The download will be started in 10 seconds. I implemented a token validation in the REST APIs but it can be extended because I am not satisfied fully. As you know that it is a demo and it may have some issues. Please be careful before using it in a real case if you would like to implement it in your application.

I had had to use Rest API with a simple token authentication because OutSystems is giving a security error when Javascript timers call server action after navigating to another screen. I didn't want to challenge with this error. I exposed two REST APIs in the same module and implemented XMLHttpRequest in Javascript quickly.

Please check the demo with oml file and let me know if you have questions.

Sincerely,
Necmettin

DownloadInBackgroundDemo.oml

Dear All,

Thank you for the response and reply, I am very happy with your reply


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.