function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.