+ Start a Discussion
Sfdc wonderSfdc wonder 

Response from Callouts


I hav one requirement.we developing one App which is integrated to 3rd party,here intigrations involve both ways of Leads syncing.
Here my 3rd party having Monthly limit of new Leads by user wise.so i need to achieve same functionality in Salesforce side.
i wrote total syncing code in Future callouts.Here whenever monthly limit reached ,3rd party sent a response as 'Your limit reached'.

i get the response but struct at displaying response Message through triggger(by using addError method).

i done some ways:

1)In my future class,insert response in temp object .and get that  Present response in trigger after calling future Method and display the message using addError method.

But i fail,may be the reason is trigger is not waitng for resopnse.

can any one Help Me for this
Ram ,

Future is more of the asynchronuos call , you can not depend on the result from the future method and then check in the trigger .
trigger and future both will run in the different thread and will not communicate .

you have to make sure that no dependecy should be there from futrue method .

Hope this helps :)


Sfdc wonderSfdc wonder
Hi vishal,

thanks for ur reply
can you advise any other possible ways....
The Other Possible way is try not to invoke webservices in trigger , if that would be from apex class then it will be synchronuos .
but make sure that class should not be called from trigger either .

anyway try avioding callout from trigger , and see how can you acheive the desiered result .

Best of Luck !!