Luis
10/08/2024, 8:36 PMCeligo AI
10/08/2024, 8:36 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To schedule the execution of another script in 5 minutes from now and pass an id as a parameter to that second script, you can use the
N/task
module in SuiteScript. However, please note that 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.
Here is a workaround that you can consider:
1. Create a custom record with a timestamp field.
2. After your first script completes execution, set the timestamp field in the custom record to be 5 minutes from the current date/time.
3. Attach a User Event script to the custom record. In the Before Load event, check if the current date/time is greater than or equal to the timestamp field in the custom record.
4. If true, then execute your second script.
Here is a sample code snippet for creating a scheduled script task:
javascript
var scriptTask = task.create({
taskType: task.TaskType.SCHEDULED_SCRIPT,
scriptId: 'customscript_script_b_id', // Replace with the ID of your second script
deploymentId: 'customdeploy1', // Replace with the ID of your script's deployment
params: {custscript_id: 'your_id'} // Replace 'your_id' with the actual id you want to pass
});
scriptTask.submit();
Please replace 'customscript_script_b_id'
with the ID of your second script, 'customdeploy1'
with the ID of your script's deployment, and 'your_id'
with the actual id you want to pass.
Remember, this is just a workaround and may not be the best practice to follow. The execution of the second script may not be exactly 5 minutes after the first script due to various factors such as script queue, system performance, etc.Celigo AI
10/08/2024, 8:37 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822224796
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817005098
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813441694
Celigo AI
10/08/2024, 8:37 PM