0

I have a trigger on the user object which calls an external web service to assign some values to every newly inserted user but now client want to insert the user's via batch(which we don't have access to) so I want to know if we can call web service without future or any way to solve this problem.

1 Answer 1

2

You can use a callout in batch Apex, to do that you must specify Database.AllowsCallouts in the class definition as explained in this link.

For example the syntax will be:

global class SearchAndReplace implements Database.Batchable<sObject>, 
   Database.AllowsCallouts{
              //Business logic you want by implementing Batchable interface methods
}

Also, you can refer to this link for implementation.

2
  • The problem here is we don't have access to batch that inserts user's as it is handled by client
    – Ishan
    May 2, 2017 at 9:00
  • 1
    You can write a utility class which handles the call out and ask the client to implement the interface and invokes your utility class method to perform the action.
    – Saroj Bera
    May 2, 2017 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .