function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rickkoterrickkoter 

Scheduled Apex Calls

I would like to schedule a block of Apex code to run several times a day to check an external web service and make updates to Salesforce objects based on the status of the call (this will be much more efficient than triggering calls based on use actions or data triggers). Reading docs and postings here, I've not come up with a clear picture of what options / alternatives and benefits exist for this scenario (but maybe I am overlooking something obvious). What are s the best approach to iniate scheduled Apex tasks?

Thanks!
Rick
rickkoterrickkoter
I found this blog description of a way of solving this... Any better ways?

http://scott.morrisonlive.ca/sfSimpleBlog/show/stripped_title/time-based-batch-scripts-in-salesforce

thanks
aggarwalaggarwal
Hi,

I am struck up with same issue. The solution link you posted here is using triggers and I understand external web service calls is not allowed from triggers. Were you able to successfully implement this?

Thanks,
Rakesh
rickkoterrickkoter
Sigh - doesn't work. I get the following exception when the web service is called.

System.CalloutException: Callout from triggers are currently not supported.
jack_lincon_zhujack_lincon_zhu

You can add  an annotation  called future. add some code like following:

@future(callout=ture) at the top of the method which you want to call  in trigger