Triggering a CPM similar to a Cron job?

Hello everyone,

I have a nightly feed of data the comes in via a Rest Service that I have stood up in a CC.
If I have a method update a BO on successful save of a json file, is it possible to trigger a CPM to execute if it is attached to the same BO that is updated?

Thank you in advance for your ideas and responses.



Hi Mark,

Short answer, "yes" it is definitely possible.

This is a really good question, and we are continually running into the need for this type of integration. What I think you might be getting at is a notify and pull system, by using the controller endpoint to allow an external system to create a notification 'queue' entry in a custom object, then using a CPM triggered by the creation of that entry to pull data from an external system. If that is the case, then as long as you set your CPM to be run asynchronously (available after August 2013), which is needed because synchronous CPMs are only allowed to run a few seconds, your CPM should be able to use cURL to pull data as needed.

That said, because it is a relatively new feature, my clients and I have run into some major issues with async CPMs, some of which have been fixed in later releases. But some still exist and rear their ugly head especially when there is load on the CPM scheduling utility. So, just a word of warning that you may need to fight with Oracle support. Hopefully most of the bugs will be smoothed out soon.

While I'm rambling, let me address your comment here, as it is related. The approach above is using an external 3rd party service to trigger a process. This is currently my recommended approach, and I will likely write a formal article on it once I have a bit more experience with it. There are other options for triggering a scheduled process, though are not recommended without good reason:

  1. Utility Cron - This requires an Oracle Consulting Services engagement to setup an actual Cron job, which can be used to trigger a custom PHP script. The cost and red tape involved in getting this setup makes this a highly undesirable option.
  2. Custom Script in a Scheduled Report - This is something that I haven't tested in recent versions, but was mentioned by one of our forum user's in this thread.
  3. Poor Man's Cron - If the exact timing of your process is not important, you could setup either a Customer Portal hook or a console AddIn (or both) to trigger upon a user interaction such as login, to kick off the process if it hasn't been run in 'X' amount of time. This should probably by done asynchronously by creating a CBO queue object which triggers an asynchronous CPM.

Again, your approach of a notify and pull queue system, using a 3rd party system to trigger the process is what I would recommend as it is the cleanest and most robust. Let us know how this works out for you!

Zircon - This is a contributing Drupal Theme
Design by WeebPal.