• Auloh Huron
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,
I have a process builder which calls Apex method (@InvocableMethod) and the apex method calls future callout, this process is failing with the below error. I have the code checking !system.isFuture() but still failing, not able to figure out.
Error element myRule_1_A1 (FlowActionCall).
An Apex error occurred: System.AsyncException: Future method cannot be called from a future or batch method: AddressValidateController.invokeAddressController(List)
Apex Code is below.
global with sharing class AddressValidateController {
    public static boolean isVerified = false;
   
	@InvocableMethod
    global static void validateAddressFromPB(List<Id> recIds){
       
        if(!system.isFuture() && !isVerified){
            integer count = 0;
            List<String> subList = new List<String>();
            for (Id recId:recIds){
                count+=1;
                subList.add(recId);
                if (Math.Mod(count, 100)==0){
                    invokeAddressController(subList);
                    subList=new List<String>();
                }
            }
            invokeAddressController(subList);
            isVerified = true;
        }
    }
    
    
	@future(callout=true)
    global static void invokeAddressController(List<Id> recIds){
        
               Address validation callout code here
    }
}

Please advice..!