0

I have a task at hand that I am trying to figure out the best way to get done. In short I need to hit an external API, GotoWebinar to be exact. I need to retrieve a list of Webinar Sessions daily including the attendees and some performance metrics as well.

To start testing I wrote a class that does the following.

  1. Get a list of GotoSessions (API Call) and insert them into a custom object.
  2. Lop through the sessions and get a list of attendees (Another API call) and insert them into a custom object
  3. Loop through the sessions and get the performance (Another API call).
  4. Update the Attendee & Performance custom object with the session ID so that related lists populate for each session.

So far in testing this is working fine but I want to know the best way to automate this daily. I have been reading about scheduled APEX, Batch APEX, @future, Queable APEx... and I am not sure what is the best way to implement this?

My thoughts are maybe, have a Queable APEX to go get the records from GotoAPI and then an APEX trigger on the Attendee & Performance object that updated the sessionID when they get created?

Hope that is enough info to start with. I am a decent coder in Java & C# so APEX has not been bad but I am struggling with how to do things the "right" way...

Thanks in advance for any help!!!

  • 2
    I would defintely suggest doing the Asynchronous Apex trailhead module to identify what and why is async apex used! – codeyinthecloud Dec 10 '18 at 18:19
0

So The best tool I can see is the Scheduled Apex. But there is a catch.

You can only do 100 callouts at max in a transaction and can update at max 10,000 records in it.

I would design it in a way that an Apex Scheduler runs an Apex Batch to handle the load. That would help you get the benefit of Scheduling at right time and also help you handle the bulk load /callouts.

Src: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_async_overview.htm

  • Thanks for the input, Luckily, the way the code is written, each time it is run there are only 4 callouts and 3 SOQL queries so I think I will stick with the scheduled option. – Jeremy Ragsdale Dec 10 '18 at 19:39
  • @JeremyRagsdale can you mark it as answer, so that other people with similar queries can reach solution faster? – user3209853 Dec 10 '18 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.