How do get results from scheduled script that has been triggered by suitelet N/task ?

I currently have a suitelet that generates a PDF and shows it in the browser with a button is pressed. For scalability reasons, I need to move this into a scheduled script or map reduce script and use the N/task library.

I have the N/task kicking off the scheduled script in my suitelet post section:

var pdfTask = task.create({
    taskType: task.TaskType.SCHEDULED_SCRIPT,
    scriptId: ‘customscript1’,
    deploymentId: ‘customdeploy2’,
    params: { custscript_params : workorder_cs }
});
var pdfTaskId = pdfTask.submit();
However, I”m not sure how to get the PDF from the scheduled script back to the suitelet so I can print to the browser.

 

Rookie Asked on October 23, 2019 in SuiteScript.

Off-loading the process to a scheduled script and/or map reduce script will not guarantee immediate execution as you will be at the “mercy” of the Netsuite queues or availability of processing pipes especially if you have multiple scheduled scripts and/or map reduce scripts running in the background. The best you can hope for by going that route is to save those generated PDFs to the file cabinet.

on October 23, 2019.
Add Comment
1 Answer(s)

I’d consider handling your task with a Suitelet. If it’s as simple as making a PDF, you don’t need a map/reduce or scheduled script to handle it and you can get around the queue.

If it’s a bit more cumbersome than just simple PDF creation, I would perhaps try something like writing the PDF down somewhere that you can go retrieve it from in your suitelet.

Beginner Answered on October 23, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor