+ Start a Discussion
Ankit Singh 6Ankit Singh 6 

Post request from Apex Classes

Hi,
I am adding a trigger to update a field in opportunities. For the same, few fields of opprortunity will be passed to a third party API which will return some data and after processing the data, corresponding field in opportunity willl be updated. I have added the trigger and class but i'm not sure how to make a API call from trigger.
AshlekhAshlekh
Hi,

You can write a future method and in future method you can call API. Please handle the bulk handling or instead of this you can run batch in which you can do same thing.


-Thanks
Ashlekh gera
Ankit Singh 6Ankit Singh 6
On going throgh furture method, it was found that future methods are asyncronous and does not return values. But in my case, I want data from the API, which will affect the trigger flow. Is there any way in which i can achieve this?