i want to trigger a scheduled script B from the ss...
# suitescript
v
i want to trigger a scheduled script B from the sscheduled script A after the task in SS A is completed. how can i achieve this? I mean after some time, how can i do it thru script?
s
At the end of the script, put this logic -
Copy code
var scriptTask = task.create({
    taskType:task.TaskType.SCHEDULED_SCRIPT,
 scriptId: 'customscript_script_b_id', // Replace with the ID of Script B
  })
scriptTask.submit();
v
yes i did , but i want to trigger this scheduled script after 10 or 5 minutes
s
NetSuite's built-in scheduled script functionality is primarily designed for predefined schedules and recurring tasks, and it may not be suitable for precise time-based delays.Below is just a suggestion & workaround , mayn’t be a best practice to follow - i. Sch A ii. Sch B Iii. Custom Record (TimeStamp field) After Sch A completes execution it will set the Timestamp field (5 or 10 mins from current date ) in the custom record. Custom record has a UE script - BeforeLoad Logic - Record keeps on refreshing and checks if - new Date() >= TimeStamp field (in custom record). If true, then execute Sch B logic else don’t.
v
Thank you i will try this
r
Consider creating a module that uses
N/record
to automatically create new deployments when one deployment is busy.
Then you can just
mod.launchScheduled()
to your heart's content.
That and an error logger for Map Reduce are essential tools for a SuiteScript dev.