Message Print Every 5 Minutes

Hello there,

I need to show users a message every 5 minutes when no transaction is made on sales orders that are not completed.

After Search I reached that piece of code for the “Msgprint” Function but how can I make it repeatable according to time range?!

Thanks in advance.

make a custom app
add a background job with

*/5 * * * *

and write your logic in the function

Server side msgprint is only useful for web request. Any msgprint during request’s lifecycle is sent to client in response.

What you need to do is different. You can achieve this in two ways:

  1. client-side with setInterval() where every 5 minutes you poll a server-side method for evaluating whatever business logic you want (or it can be done fully client-side too)
  2. CRON job like the previous post mentioned. But with cron job you probably need to emit events via socketio and client side needs to listen for that. Seems rather complex for this.

I need to show users a message every 5 minutes when no transaction is made on sales orders that are not completed.

This sounds very dystopian ngl. Not my place, but you should probably relook at the root cause of the problem you’re trying to solve with this :slight_smile: