I have a Scheduled Script with 20 deployments. Is...
# suitescript
d
I have a Scheduled Script with 20 deployments. Is there a way I can check how many 'idle' deployments are available BEFORE submitting a task.create()?
a
haven't done this kind of thing in a long time, it used to be that you couldn't lookup this info and so you would just have to try each deployment, have it fail, catch the error and try the next deployment
I haven't checked but I'd hope maybe the query module let's you query the task scheduler tables or something? but maybe not
the only way you can get instance status is if you already have the instance id and you're only going to have that if you just created the task yourself and it was returned to your code
i
what is the use case? are you trying to check to make sure their is an available deployment before trigerring one? if you just leave the deployment field blank i believe it used one if available else it creates one automatically
a
wait what?
n
I am not sure it creates it automatically but if you leave the deployment id to blank, it auto triggers the available one.
b
you can do a search on scheduled script instances to see which are in the queue
the number of available deployments isnt actaully as useful as you think it is
usually you want to know that information in the context of a user event script, and those can run concurrently, so hoping for an available deployment isnt enough if you have multiple user events trying to create a task
d
SO, my use case is ... I have a batch of TASKS to execute. I don't want to start the batch unless there are enough deployments to trigger the TASKS against.
I'd like to be able to response with a
Not enough deployments to accommodate the number of requested tasks.  Only ${num_of_idle_deployments} available for ${num_of_requested_tasks}.  Please reduce the number of tasks or wait for more available deployments
e
Was hoping it would be something like
Copy code
SELECT d.deploymentid, i.status, i.taskid
FROM scheduledscriptdeployment d
JOIN scheduledscriptinstance i 
ON i.internalid = d.script
but that just yields `Invalid or unsupported search`; it's not actually clear to me how the
scheduledscriptinstance
table links to the
scheduledscript
table.
My SQL is quite bad though
d
And there's the rub ... there MUST be a link somehow, its just not exposed/documented
I tried having AI decode the TASKID to see if there was anything hidden inside that string, but I came up blank
b
do a search, not a query
the search has a usable join to the script and the script deployment