• Amir 3
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello all,
We are encoutring a wierd behavior in Salesforce trigger. The trigger seems to run once but one out of 2 callouts seems to be sent twice without any infomation in the debug logs.

The idea:
When a certain object’s attribute changes -send an HTTP request to two endpoints using Apex trigger.
The Apex code will first send a GET request to some endpoint.
Then, it will send a POST request to some different endpoint.

Implementation:
We added a trigger on object A - on update (when status changes to complete).
We added an Apex class that has a future method (decorated with @future(callout=true)) that will call two endpoints.
Inside the trigger a condition is checked and a callout is sent if the condition is passed.
The endpoints were added to the remote sites of the environment.

Problem description:
The receiving side reports two requests were received at the second endpoint (both requests received are identical) while we only see evidence of one http send in the debug logs.

Details:
The behaviour occurs even when triggered from the layout (status change to complete).
The time between the calls varies from 4 to 10 seconds.
When we look at the logs we only see one request sent, always.
When we send the request to that endpoint not from salesforce only one request is sent (tested using the same endpoints).
When we changed the endpoint to a different one we only see one request (when endpoint is hosted on our side, without any logic).
The code is extremely simple and does not contain any complicated logic.
We couldn’t find in the documentations any explanation to such behaviour.
The first GET request always fires once, the problem is only relevant when calling the second endpoint.

We can't find any reason for this behaviour especially not from our code.
Do you know of any reason why this should happen?
  • January 12, 2020
  • Like
  • 0
Hello all,
We are encoutring a wierd behavior in Salesforce trigger. The trigger seems to run once but one out of 2 callouts seems to be sent twice without any infomation in the debug logs.

The idea:
When a certain object’s attribute changes -send an HTTP request to two endpoints using Apex trigger.
The Apex code will first send a GET request to some endpoint.
Then, it will send a POST request to some different endpoint.

Implementation:
We added a trigger on object A - on update (when status changes to complete).
We added an Apex class that has a future method (decorated with @future(callout=true)) that will call two endpoints.
Inside the trigger a condition is checked and a callout is sent if the condition is passed.
The endpoints were added to the remote sites of the environment.

Problem description:
The receiving side reports two requests were received at the second endpoint (both requests received are identical) while we only see evidence of one http send in the debug logs.

Details:
The behaviour occurs even when triggered from the layout (status change to complete).
The time between the calls varies from 4 to 10 seconds.
When we look at the logs we only see one request sent, always.
When we send the request to that endpoint not from salesforce only one request is sent (tested using the same endpoints).
When we changed the endpoint to a different one we only see one request (when endpoint is hosted on our side, without any logic).
The code is extremely simple and does not contain any complicated logic.
We couldn’t find in the documentations any explanation to such behaviour.
The first GET request always fires once, the problem is only relevant when calling the second endpoint.

We can't find any reason for this behaviour especially not from our code.
Do you know of any reason why this should happen?
  • January 12, 2020
  • Like
  • 0