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
Óli Þór GunnarssonÓli Þór Gunnarsson 

Monitor http response in future method with callout

Hi,
I am implementing sync between Salesforce and another system.
When Account is updated in Salesforce I need to call web service to update the account in the other system.

For this, I have trigger on Account after update that gets the fields being changed, builds json string from that and calls future method that does the callout.
This is all no problem but I want to make sure that the change is done all the way. (I am responsible for this until I get handshake back from the web service)
What can happen in the future method is that the web service callout gives me timeout, I can receive other response codes than 200/201 etc.

How can I monitor this callout and for example try again if I get timeout, notify the user etc ?
Valentin F.Valentin F.
Hi Oli,
if(resp.getStatusCode() == 200) {
     //your code here
} else {
     //send email method
     //fill custom field only visible by you
}
Have a good day,
Valentin