You need to sign in to do that
Don't have an account?
Margaret Fleischaker
Pass webservice a collection of objects
We need to add a trigger on Lead insert that calls a web service and returns a value, setting a field on the Lead.
I know that I'll have to use the @future annotation. But am I going to run into limits if say, 500 leads are inserted at the same time? Instead of the below code...
I haven't worked with web services before and I'm obviously a little lost, so any guidance would be appreciated. Thanks!
I know that I'll have to use the @future annotation. But am I going to run into limits if say, 500 leads are inserted at the same time? Instead of the below code...
Trigger newLeadTrigger on Trigger (after insert) for(Lead l : Trigger.new){ Util.callWebService(l); } } public class Util { @future public void callWebService(Lead l){ /* Web service callout. */ } }Would it be possible to do something like this, and only do one callout rather than 500?
Trigger newLeadTrigger on Trigger (after insert) Util.callWebService(Trigger.new); } public class Util { @future public void callWebService(List<Lead> leads){ /* Web service callout. */ } }
I haven't worked with web services before and I'm obviously a little lost, so any guidance would be appreciated. Thanks!
This isn't the most efficient way to handle this as the Heap size can get a bit big since you'll be esentially doubling the Lead list in the trigger. Alternately you could just pass it a Set of Lead ids and re-query them in the future call.