I have a Suitelet that parses a CSV file and then ...
# suitescript
s
I have a Suitelet that parses a CSV file and then passes the object to a Map/Reduce script to create payments. I would like to display the M/R summary results on the Suitelet after everything is processed. That said, what is the best way to pass the M/R summary object back to the suitelet after completion? Is it possible to pause the Suitelet while the M/R is processing, and then continue after it gets the results back?
d
When your suitlet starts the N/task for the M/R keep ahold of the task ID that was sent back. From that you can ping the status of the M/R every 10 seconds or so. I do this and update a progress bar. The status will then tell you when it's complete and you can use N/cache or a file to get the results. Or is you wanted you could even display results as it progresses using N/cache.
👍 1
s
That's awesome! I really appreciate the guidance.
✔️ 1
Quick Question: How would I go about pinging the M/R every 10 seonds in a Suitelet?
d
Use a client script and just JavaScript set timeout
s
running into a bit of a challenge: The client script will timeout for 10 seconds, but the suitelet just keeps procesing the rest of the code to completion. I'm not sure how to continue to ping the TaskStatus inside the suitelet and continuously update the status on the form. The ClientScript doesn't allow N/Task.
d
In your suitelet you would have a POST using parameters to identify the call. The suitelet utilizes the N/Task to return the data back to the browser to show the progress.