If you really have a long running server action, writing directly progress from it won’t work because all the output is send at the end all at once.
But there is a way - it might look a bit complex, but bear with me
What you can do is save the progress messages in a Session variable and then use another Server Action to query the progress regularly while the long running action is still busy.
This will be something like:
Long action:
- IMPORTANT: make sure you increase the script timeout in the action settings otherwise the action will be terminated after 30 secs.
Steps:
- set session name: progress, value: upload started
- upload file
- set session name: progress, value: import started
- import csv
- set session name: progress, value: database insert started
- insert step
progress action:
- define $_SESSION with name ‘progress’
- add a step set variable = $_SESSION.progress
- enable the ‘output’ option for the step
Client side
- add the server connect action for the progress
- populate a progress somewhere with the message
- create a action scheduler, that will run the progress action regularly, but don’t auto start it
- create a define where to run the long running action.
- on run of the long running action also enable the action scheduler so it starts poling of the progress server action
- on end of the long running action - stop the action scheduler.
So something like this might work
Maybe @Hyperbytes or @fatherofinvention can try it out and if it works make a nice tutorial from it