scheduled script is running every hour and I need to send email at specific time in the scheduled script
u
_nikhilpalli
02/21/2020, 4:30 PM
Copy code
if(new Date().getHours() == 23)
sendEmail();
e
erictgrubaugh
02/21/2020, 4:41 PM
^ unless the account isn't on the CST datacenter
erictgrubaugh
02/21/2020, 4:41 PM
or the company timezone isn't set to CST
erictgrubaugh
02/21/2020, 4:43 PM
I don't have any context at all on what your script is doing, but I'd probably separate them into two separate scripts. The one running every hour would create/update records, probably custom, with all the required data, then the Scheduled Script just runs once, searches the requisite data to compile and send the email.