A powerful component to the rules application is its ability to schedule and execute actions at future times. When actions are scheduled, they will be listed in the "Scheduled Actions" management table located in your ACP. Any number of actions can be scheduled at any given point in time and they will be queued in the management table until their scheduled execution time is reached.
At any point after scheduling, actions can be manually executed ahead of time, or their scheduled date can be changed manually. In the case of manually scheduled custom actions, action arguments and scheduling details can also be edited at any time.
Actions Scheduled From Rules
When actions are added to the "Actions" tab of a rule, you have the option to either have that action happen in real time, or be scheduled for execution at a future date/time. Any action can be scheduled for a future time (including custom actions) when adding them to a rule.
Sometimes it is desirable to only have a single instance of an action type in the scheduling queue. For example, when a user logs into the system, you may decide to schedule a follow up email to that member in a couple of months to invite them back to the community. In this case, you don't really want to them to receive every scheduled email, but only the last instance of the email that you scheduled (so that the only email they will receive is the one that was scheduled the last time they logged in, which would have been a couple of months ago if the action ever reaches it's scheduled date).
In order to accomplish this, a scheduling keyphrase must be used. A scheduling keyphrase is like a unique identifier for the scheduled action which will ensure that only one instance of that action can be present in the queue at any given time. If another action is scheduled using that same keyphrase, then it will overwrite the existing scheduled action.
And since it's usually necessary to be able to have a single instance of a scheduled action in the queue for multiple entities in the system (such as members), tokens can be used in the keyphrase in order to vary the keyphrase by the entity. For example, a keyphrase such as "Send follow up email for member:[member:id]" uses the token [member:id] which will be replaced by a member id (assuming that token is available in the tokens list for the event). This ensures that each member can have their own individual instance of the action scheduled in the queue at the same time, but only once per member. Any number of tokens can be used in the keyphrase to make it unique to its application.
Actions Scheduled Manually
You can manually schedule a custom action to happen at a pre-configured date and time. Custom actions can be scheduled manually to happen on a recurring basis or as a one-time event. To schedule a custom action manually, click the dropdown arrow for the custom action on the "Custom Actions" ACP page and choose the option to "Schedule Manually".
Recurring Scheduled Actions
When you manually schedule an action to happen on a recurring basis, the specified time period will be automatically reset and the action rescheduled each time the custom action has completed its run. From the manual scheduling page, choose "recurring" as the action frequency option and then specify the time period between each time the action should be ran.
Each argument that your custom action uses can be configured manually for the process. You can optionally choose a "bulk processing argument" from the bulk process option in order to run the action repeatedly for each of the records in the system associated with the bulk processing argument. For example, if one of the arguments to your custom actions was configured to accept a member object, then selecting that argument as the bulk processing option would run the custom action for every member in the system on each scheduled run.
Note: When you choose a bulk processing argument, you can set a limit on the number of records in the system that will be processed on each cron run until the processing cycle is complete.