2

Relatively new to SP, and can't seem to find anything definitive on whether a JavaScript function can be set to execute daily, or at some other period.

Currently have a utility function page with buttons that trigger process intensive updates for list items and would like to automate the process to occur every night.

Seems unlikely since it's CSOM, but maybe there's another route that can wrap around the scripts and execute them server side?

Maybe the script could be launched from a workflow which loops after a period of time?

Thanks in advance.

2 Answers 2

3

If you REALLY want to you can use javascript setTimeout to run a function after a specified time has passed, but that'll require you to leave the page open in the browser all the time.

An option could be to have a scheduled task open IE with the page.

But I'll suggest you bite the bullet and rewrite your code into either a workflow or a windows service or if this is on-premises into a TimerJob as this is what these are for

1
  • It's on premises, but I'm working from a machine without a local install. Thus no VS hook-up to write a timer job. I'm sure it's not 100% out of the question, but if I can utilize the existing toolset it'd be preferrable for now. Can I use a list or site workflow to execute a script sheet periodically?
    – Joe
    Oct 5, 2013 at 8:33
3

Scheduled timer jobs on the server would be better alternatives, either an actual Sharepoint timer job or a scheduled task that executes Powershell. setTimeout and setInterval can schedule things to be run, but as Per mentions, the browser window needs to be open constantly.

1
  • Would rather have it execute overnight without leaving my machine running, but worst case I could use this in the interim until I have a better solution running. Thank you.
    – Joe
    Oct 5, 2013 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.