1

I know some basics on callouts but would like some advice on doing multiple callouts.

Requirements: I have an external system where guests are registered this could be large amounts. I have to get these into Salesforce and also check if there are updates to these external records. This has to be near realtime.

  1. How does for example handeling 1 million records work. Does the callout make partitions and batch process these records?

  2. If a record changes in the external system do I need to do a callout for all the records and check for changes?

  3. If I do a callout every minute do I run into limits and will my object be locked all the time?

2

How does for example handeling 1 million records work. Does the callout make partitions and batch process these records?

Yes, you would need to do so in batches.

If a record changes in the external system do I need to do a callout for all the records and check for changes?

No, you need to ask the system for external changes. Requesting 1,000,000 records per minute from the external system would need something like 250-500Mbps. This is enough to bring most servers to their knees, and at the very least, the IT department will be begging you to stop.

If possible, if you really need real-time, though, the external system should notify Salesforce of changes instead. This is much more practical and involves less code in Salesforce. Asynchronous code can be delayed when the system is under heavy load, so your real-time updates could start to lag during the day. If you need real-time, you really want to avoid using asynchronous code.

If I do a callout every minute do I run into limits and will my object be locked all the time?

No, you shouldn't run in to any limits, and objects are never "locked", only individual records. As long as the records are held only briefly, there shouldn't be a problem.

  • Thanks for your explanation. On my first question is there any documentation/examples on how to do this in batches? – Thomas Oct 15 '18 at 8:04
  • @Thomas There really isn't "an example" that way, because it depends on what you're doing exactly. Honestly, for an initial load, you're better just importing the 1,000,000 records. You can go ahead and look through a search engine to see if you can find something applicable, but there's so many variables, it might not even help you. – sfdcfox Oct 15 '18 at 11:59
  • Ok but all I can find is The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. Is this related to my records in my JSON string or how large the string is? – Thomas Oct 15 '18 at 14:55
  • @Thomas all relevant limits are here: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… – sfdcfox Oct 15 '18 at 15:05

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.