+ Start a Discussion
subbu.flex9@gmail.comsubbu.flex9@gmail.com 

@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.

sfdcfoxsfdcfox

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) {
    a.b();
}

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.

subbu.flex9@gmail.comsubbu.flex9@gmail.com

ok that is fine , ewhat about webservice ?

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

sfdcfoxsfdcfox

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.