+ Start a Discussion
Dippan PatelDippan Patel 

Lead created by LMA causes Trigger failure "System.CalloutException: Callout loop not allowed"

Hi, 

I have a trigger that is making a callout after insert. The trigger is failing with the exception "Callout loop not allowed" only in case when lead is created by LMA. For rest of the cases it is working fine. Is there any workaround or solution for the issue? 
 
//Test Code 

trigger testTrigger on Lead (after insert) 
{ 
	for (Lead lead : Trigger.new) { 
		//call TestClass.testCallout()  
	} 
}
public class TestClass { 
	
	@future(callout=true) 
	public static void testCallout() { 
		Http http = new Http(); 
		HttpRequest req = new HttpRequest(); 
		req.setMethod('POST'); 
		req.setHeader('Content-Type', 'application/json'); 
		req.setEndpoint('https://testendpiont.com'); 
		req.setBody(body); 
		HTTPResponse res = http.send(req); 
	}
}



 
SwethaSwetha (Salesforce Developers) 
HI Dippan,
Have you tried the resolution mentioned in https://help.salesforce.com/articleView?id=000340086&type=1&mode=1

Can you share more details on the steps to reproduce this scenario so I can check from my end too?Thanks