I know as per documentation, we cannot perform DML and then callouts from apex class. In my scenario, I have a callout then I am performing a DML which is placed inside a future method and again there is callout after the call to future method.
Still I am getting "You have uncommitted work pending" error.
Is the solution (apart from changing the order) only to make the callout in future and DML directly? Can't we make DML's in future method to avoid this.
Relevant Code:
global class docuSignConnector {
public static String callDummy(){
// Making HTTP Callo
// making call to future method to insert log object for integration
createIntegLog.createIntegrationLogFuture(req.getBody(),res.getBody());
//Making HTTP callouts again - getting mixed DML Error here
}
}
public class createIntegLog{
@future
public static void createIntegrationLogFuture(String reqBody,String resBody)
{
// Insert the Log Object here with req , response data
}
}