0

Documentation in here says

• You can only use the webService keyword in a trigger when it is in a method defined as asynchronous; that is, when the method is defined with the @future keyword.

But i can define a webservice method in apex as below

  global class myclass{
    webservice static void check( string a)
    {
        system.debug('WEBSERVICES are invoked');

    }
}

and make it call in my trigger as below without declaring method as asynchronous

trigger mytrigger on account(before insert)
{
myclass.check('hello');
}

In debug log i can see webservice is being called

Is documentation correct? or is talking about callouts?

3

I suspect that it's supposed to be referring to callouts, but perhaps the original intention was that methods marked with webservice were counted as callouts in the context of trigger execution, i.e. they shouldn't be allowed unless they're asynchronous.

I get the feeling this particular piece of documentation needs some attention because at worst it's inaccurate or out of date, and at best it's not readily clear. Time to click the feedback links at the bottom!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.