Thank you. Is there a way to write the conditional on the Scheduled Script Execution so it only runs if there are any records where the Requested_for_Email is null? I would prefer that it not run unnecessarily if there are no records to even be run against. Is there a method of setting the Scheduled Script Execution to be inactive (Uncheck the active checkbox on the record itself)?

It's running like a charm! Thank you! So now, is there a way to set an Order By to for example update the oldest Created dates first? Right now, there doesn't seem any rhyme or reason in which order these are being updated, but at the moment it does NOT appear to be updating by "Number" order or create date. Is there a preference for what order it does these updates, so long as they fulfill the .addNullQuery requirement?

You may use the line below to order the NeedIt records in ascending order.

needit_gr.orderBy('sys_created_on');

 

Bert_c1
Kilo Patron

Set the scheduled job to run "on demand".

Piemur1
Tera Contributor

@Bert_c1  I don't want to run it "on demand" as that would require me to continually run it manually. "Periodically" is better because then I can schedule it to run every x minutes or hours or whatever timeframe I wish and repeatedly with a batching option so it doesn't saturate the server with a huge update that hypothetically could be the entire database. As I stated, this is a hypothetical update wherein I wanted to configure a batch job to run on a limited subquery of the database to update a lot of records but batched out to smaller chunks until completed. "On demand" would be like setting the job, but having to manually hit "execute now" over and over and over until they have all been completed. Doable if I were updating 1800 records in 100 record batches only 18 times, but what if I were updating 8,000,000+ records with a lot of updates? Do I lock up the database trying to run it on all those records at once? Let's say the updates are very resource intensive, so it would be best to ONLY run it in chunks of 100 records at a time. Any more, and it would lock the system and no one can get anything done until the batch is done. Do I have to hit the button to run 8000 times? Or set a job to chunk it out every 10 minutes, give the system time to breathe and users able to do some work, and over time will eventually have managed to process all the records? THAT is the intent of the question. I wasn't aware of the x_gr.setLimit(100); function nor some of the functions for setting up queries and x_gr.next() loops, considering I am a relative beginner developer in the environment.

 

All criticism aside, thank you for the advice. I understand you're just trying to help. ❤️ Just wanted to explain why that option would not work for my hypothetical scenario.