What is the best way to trigger a CloudCode task while offline so that it queues and runs once the connection is re-established?
The best option would be through the use of webhooks if you want to trigger a CloudCode task from within the application code while offline. There is an option to trigger a CloudCode task from within the application, but this requires connectivity. You should rather trigger the CloudCode task using a webhook.
type can be configured as a
update . A
ready webhook will only be triggered once for a specific object when the conditions are met. An
update webhook will be triggered each time the object is saved and the conditions are met. Because of JourneyApps’ offline sync system, as soon as the device triggered the
update webhook comes back online, the CloudCode task will run.
You can find more information on triggering a CloudCode task via a webhook in the documentation here.
If you want to limit your CloudCode task from running in parallel, please reference this post: Prevent CloudCode tasks from running in parallel.