Hi,
Javascripts execute at server side only. If you want to run any queries , can you please make use of SQL job type - https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/ca-workload-automation-de/12-4/scheduling/job-types/database-jobs/define-an-sql-job.html
Hope it helps!
Ravi Kiran