You need to sign in to do that
Don't have an account?

Updating an external system using REST callouts
Hi
I have this requirement and I need some expert advice.
I need to inform a 3rd party system with changes to my records (Create, Update and Delete) using a REST callout.
I have these constraints:
- Inform on record updates only when specific fields have been changed (only these fields that the other system is interested in)
- If the other system is not available, keep trying to inform it, or retry in predefined intervals
What is the best way to achieve this?
Does anyone know of a solution for this available out there or had implemented something like this before?
Thanks a lot
Kruvi
It would remain a possibility for sure - I think that's the trade off. With batch you get the luxury of trying to do a "deep pull" as it were, but the order of execution isn't under your control (as I'm understanding it). You might need to try both approaches in a sandbox with a realistic data set to see the best outcome.
All Answers
For clarification - are you using the Force.com REST API for CRUD - or are events happening on Force.com which you need to inform a third party system, and that third party system has a REST API?
Hi
Third party system has a REST API, I'm using a trigger to initiate a REST callout to the 3rd party after the CRUD
Thanks
Oded
So I'm guessing you're looking more for the second bullet point, since it sounds like you probably already have:
For recording when that future based callout fails, I'd recommend creating a custom object which can record the information you need (like the record id from the original event) and then use scheduled Apex to check for the existence of the "failed" records. Apex can then attempt to send again to the third party and delete the custom object if needed.
Yes
I think of using a batch job, in my case the order of callouts is importent, but how can I maintain the order if I use batch?
Can you set the related query to either the created date of the custom object, or an autonumber?
Yes, but if I understand the documentation correctly the order of execution is not guaranteed to be as passed from the start method. Correct?
Right - with Batch you might need to try and enforce it programmatically ... but you also might look at using the schedulable/Apex Scheduler instead. That's a simpler interface where the SOQL would take place within the same execute transaction.
I might need to try this, but I still have one doubt - if I'm not using a batch process wouldn't I have a problem with the SOQL query size limits?
It would remain a possibility for sure - I think that's the trade off. With batch you get the luxury of trying to do a "deep pull" as it were, but the order of execution isn't under your control (as I'm understanding it). You might need to try both approaches in a sandbox with a realistic data set to see the best outcome.