You need to sign in to do that
Don't have an account?
Secured Signing Developer
@future method not working
I have a method in Lightning server controller. This method will call an external API. And before calling out, it would check the token. if it's expiring soon, e.g. 1 day, the method will call a method to refresh token.
The @future method should be very perfect for refreshing token. otherwise it would have a calloutexception error.
But now the problem is even I do nothing ('comment all the code') in the future method, it throws calloutexception error 'You have uncommitted work pending. Please commit or rollback before calling out'. if I remove @future annotation, it would be fine.
So strange!
The @future method should be very perfect for refreshing token. otherwise it would have a calloutexception error.
But now the problem is even I do nothing ('comment all the code') in the future method, it throws calloutexception error 'You have uncommitted work pending. Please commit or rollback before calling out'. if I remove @future annotation, it would be fine.
So strange!
call @future method itself will create a record so no callout can be called after calling a future method
All Answers
I think you can do 10 callouts in a single class, and you must do these before calling DML statments.
so, make the loop collect up a list of objects values , then insert or Update them after you have completed the callouts
hope it will be helpfull.
Thanks
karthik
call @future method itself will create a record so no callout can be called after calling a future method