+ Start a Discussion

@feature method call from trigger

how to call @feature method call from trigger ? can any ple tell me 

1. is it possible to make a call from trigger ?

 if possible how give  two line code .



                                              thank u.


I presume you mean @future?


It's used like any other static method:


public class a {
    @future public static void b() {
        // Do something here


trigger c on D__c (after insert, after update) {

Note that you are limited in the number of future calls you can call per trigger, so your function must be able to support batches of records, if applicable.


ok that is fine , ewhat about webservice ?

how to call webservice method from trigger ? give me sample code two lines , thank u 


Using prior example, function b() inside class A would call the web service; you can't callout during a trigger directly.


You can use WSDL2Apex (the UI for importing WSDL files) to generate the appropriate bindings.