You need to sign in to do that
Don't have an account?
Prasad Ruwanpathirana
how make call for a rest service from future method?
I'm going to call for a rest service to the same salesforce instance to make a dml operation from a future method. In the future method i'm calling to a another webservice and then after i'm going to make that dml operation through the rest service. But i'm getting the "caused by: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out" error. Is there any way to do that dml operation in the from the future method?
system.debug(x);
}
public static void currentdebug(object x) {
system.debug(x);
}
// synchronous example:
@istest public static void testsync() {
test.starttest();
currentdebug(1);
currentdebug(2);
test.stoptest(); // OUTPUT is 1, 2
}
@isTest public static void testasync() {
test.starttest();
futuredebug(1);
currentdebug(2);
test.stoptest(); // OUTPUT is 2, 1
}