A future method runs in the background, asynchronously. You can call a future method for executing long-running operations, such as callouts to external Web services or any operation you’d like to run in its own thread, on its own time.

learn more… | top users | synonyms

2
votes
2answers
40 views

Debug or view status of a @future method

Can I see the errors or debug messages my @future calls may be generating? How can I see if a @future method was executed at all? Details: I have a trigger which needs to update some User accounts in ...
2
votes
1answer
20 views

Performing mass data evaluation using @future

I have a use case of creating/updating the records for a custom object based on a specific Account's record type. Its on the click of a custom button placed over detail page, its working fine for a ...
4
votes
3answers
63 views

Error in using multiple @future methods

I have created a Trigger and Class that works in dev environment, but I'm trying to deploy it to production, and it is testing all of my code with all the other classes in the environment. The only ...
0
votes
1answer
28 views

Dml operation that depends of Set up operation salesforce

I have to update owner of object (DML Operation ) but before i must to insert PermissionSet that given permission to user to be able to be the owner all of this happend in update Trigger ?? Do you ...
0
votes
1answer
41 views

What is the best practice of chain trigger

I had a scenario about 3 sObjects (Opportunity, CustomProduct, CustomSample). Both CustomProduct and CustomSample had lookup field to Opportunity. Each sObject have triggers (immediately and future ...
5
votes
2answers
106 views

Future Method calling Another Future Method

I have two future methods f1 & f2. Each of them takes long time to process as such I have annotated them as @future. There is a scenario in which I need to make a callout to f2 from f1. Any ...
2
votes
1answer
25 views

NULL POINT Exception

I am getting NULL POINT Exception error when running my unit tests and can't seem to figure out how to go about this one. This is the error Message; |FATAL_ERROR|System.DmlException: Insert ...
3
votes
1answer
31 views

Testing @future method Failed Assertion

I have some code that after inserting a task, calls an @future method to update some fields on the contact linked to that task (WhoId). This seems to work fine in sandbox, but I can't seem to get it ...
0
votes
0answers
24 views

@future method fired from trigger - order of execution [duplicate]

Quick introduction: I Approve one of many approval levels on my custom object the before update trigger is fired I'm searching for the approver comments but nothing's there yet (operations are not ...
2
votes
3answers
64 views

Can future execution start before the synchronous execution is completed

Is there a way for @future annotated method to start execution before the synchronous request which invokes it has completed. In other words, do I have some guarantees that the timing will look like ...
3
votes
1answer
36 views

How can I create over 10,000 records with information from Visualforce?

I have an inventory input page that I am working on and I am running into an issue where I need to create more than 10k records. The problem here is that all the information needed is not stored in an ...
1
vote
0answers
33 views

Test Method for callout in Future method

I have a trigger on Account. On Account insert, I am sending a callout through future method. I am trying to write a test class for this but I am getting either of these two errors - 1) You have ...
0
votes
1answer
162 views

Webservice Callout Exception: IO Exception: Read timed out

I have Salesforce trigger that triggers either a future method or batch job that does call outs to a SOAP webservice. I am randomly getting "(IO Exception: Read timed out)" exception. When the ...
0
votes
1answer
42 views

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY error in production

I got following error in production. Apex script unhandled exception by user/organization: 00580000005FYRy/00D80000000PQ16 Failed to invoke future method 'public static void updateSubs(List)' on ...
1
vote
1answer
104 views

How to pass SObject in future method?

I am a beginner in programming world. I know the reason for error that we cannot use sobject as parameters in future method. Checking on forums i came to know that we can use set and then query record ...
1
vote
1answer
60 views

Future call inside schedule batch

I am working on case where a scheduled batch calling a future method/class. As salesforce restricts the future call from batch , i am looking for any other alternative or workaround for this . I ...
0
votes
0answers
141 views

how to test a future method which makes callouts?

I am practising the Integration workbook provided by salesforce. In tutorial#2 there's a class which makes future callouts to a Heroku app.This class is called by an after update trigger. Callout ...
1
vote
1answer
145 views

Why Inserting User must happen in a future method?

I found this statement "Inserting a user with a non-null role must be done in a separate thread from DML operations on other sObjects" "here" and below is the code: public class MixedDMLFuture { ...
5
votes
1answer
112 views

Calling a Callout via @future still gives uncommitted work pending error

Class A is simple page controller. It creates an instance of Class B. The user can click a button on a VF page to invoke a pagereference method in Class A that will invoke various methods in class B, ...
2
votes
1answer
67 views

Prevent trigger from running in single test

Ok so I have a fairly complex scenario I need to test... I have a Trigger on a MyObject__c that creates PermissionSetAssigments when MyObject__c is inserted. Because PS Assignments are system ...
0
votes
0answers
86 views

Trigger not executing @future method for bulk transactions

I'm wondering can anyone help? I have an after insert, after update trigger on Contact that calls an @future method in a helper class to create portal users for contacts. In an attempt to prevent ...
4
votes
1answer
637 views

Can Queueable solve “Future method cannot be called from a future or batch method”?

I have code that must be called as @future as it requires all the resources one can get. The only problem is that in 1% of the cases this code is called from a Batch and therefore fails with ...
2
votes
2answers
1k views

Calling future method from batch class?

I got a situation where i need to invoke future method from batch class. And i know that it is not possible to do. But there might be some workarounds to achieve it, right? And i dont want to invoke ...
3
votes
1answer
128 views

Call @future from @RemoteAction?

Can you call a @future method from a @RemoteAction method? I've got an installed package that runs a VFRemoting and they allow me to write a plugin for part of the process. The issue is, I'd like to ...
1
vote
1answer
123 views

Trigger to make @future callout to the Data.com match API

My company uses data.com premium. We want to create a trigger that will update a lead based on company information since the out-of-the-box functionality only matches based on the lead. (contact). I ...
0
votes
1answer
43 views

Invalid Signature in Future method

When a user get inserted, I have @future method call which updates Contact and call another future method. Trigger Code ...
3
votes
1answer
62 views

Create a Class that I can access from my trigger to login as another user

I need to be able to impersonate another user from my Trigger, and thinking that I could create a class that logins as another user using the REST API and then post messages from that class. How ...
0
votes
1answer
379 views

Mock Unit Test for a REST API callout

After attending DF14 I have a fairly solid understanding of the HttpCalloutMock() when unit testing for REST callouts, but I'm having trouble implementing unit testing for the first time. The ...
1
vote
1answer
258 views

REST API calls to 3rd Party (Pardot), multiple @future callouts

Setup: Pardot (3rd Party services I'm using) requires you to request an API_Key by submitting your email, password, and user_key so that you can then use the api_key with the user_key to do any API ...
3
votes
1answer
127 views

Using @future tag on Apex Webservice but code not executing asynchronously

With the winter '15 release over the weekend some mission critical code for us is now getting the infamous "Apex CPU time limit exceeded". It worked fine for the past 8 months until this release. (as ...
6
votes
2answers
201 views

How to test @future methods with setup objects and avoid MIXED_DML_OPERATION

I’m in a situation where I have to use a future method to avoid MIXED_DML_OPERATION error. I have a trigger that runs after INSERT on USER and creates a custom object X. They are in 1:1 relation. ...
0
votes
1answer
226 views

Code in a @future method not working

I am trying to write a trigger that will transfer attachments from a Task object to the related Opportunity object from emails & attachments using Salesforce for Outlook. I have the basic trigger ...
4
votes
0answers
68 views

Async Callout Test Failing in Production

Situation I have implemented an API to communicate with the external system. After 18th of August test that i have on production have started failing showing the infamous: ...
0
votes
1answer
317 views

System.LimitException: Too many future calls: 11 [duplicate]

when i am changing the case owner for more than 10 records in the case list it is throwing the error : Apex trigger LFIQTriggerForCaseChanges caused an unexpected exception, contact your ...
4
votes
1answer
144 views

What approach to take if one standard object need to use different @future call from API?

I am still new in Salesforce and have Java background.There some governor limit that I totally not sure what to do. The issue started when I need to update the Account object with the value that I ...
5
votes
1answer
2k views

Future method cannot be called from a future or batch method, Case Trigger with Salesforce for Social

I get the following inside a Case Trigger when I try to call a future method: System.AsyncException: Future method cannot be called from a future or batch method So far this exception ONLY occurs ...
4
votes
2answers
221 views

Concurrent HTTP callouts vs single callout

Background I have 3 identical HTTP servers, holding the same data: api1, api2 and api3. I want to query this data as reliable and quick as possible. In Java, I would have done this by spawning 3 ...
4
votes
1answer
175 views

Sandbox batch execution takes too long to be completed(simple task)

Is it true that running a batch class in Sandbox with incredibly simple task takes too long than Production? I've tried @future with the same task and it process my Streaming API immediately. ...
1
vote
0answers
74 views

Making apex callout after sendEmail() in Batch apex

This is related to question, Processing callouts from Batch, but is specific to Emails operations. We are sending contents of email in apex callouts. The content contain merge fields, which is not ...
4
votes
4answers
400 views

Chaining @future methods

Is there any way/workaround at all to call a future method immediately from another future event? If not what's the fastest way to call my future method indirectly? I basically have a 3rd party ...
0
votes
1answer
153 views

Hitting future call limit with Geocoding trigger

This trigger seems to work pretty well for Geocoding accounts... trigger AccountGeocode on Account (after insert, after update) { system.debug('AccountGeocode trigger fired'); ...
7
votes
2answers
145 views

Callout from a future event

I have a managed app that does a callout (REST API POST) on Account save. The managed app is developed by a 3rd party that we have no control of. The callout creates a future event which gets an id ...
1
vote
1answer
104 views

How to deserialize JSON inside @future?

This issue lead after I solved one issue regarding JSON Deserialization.Now I need to extract JSON using @future method.I retrieve the JSON and try to deserialize it, but it said it does not recognize ...
2
votes
0answers
388 views

Issue creating user and setting password

I am experiencing an issue creating users and setting their password. I have a need to setup a great deal of users but only activate them as they attempt to login. The creation process and activation ...
3
votes
0answers
141 views

@future and triggers

I want to do a bulk update of records in parallel, but Batch Apex doesn't permit this. I was wondering if the following solution would work: I have an SObject defined that holds a value for the ...
1
vote
1answer
225 views

System.AsyncException: No enclosing class for method: methodName

I have this error that says "System.AsyncException: No enclosing class for method: methodName". The code structure : trigger trgSendRecords on DataSetup__c (after insert) { /* SOME BUSINESS ...
7
votes
3answers
831 views

Is there any way of confirming that an @future method has been called/queued in a test class?

I have a Controller (FooController) which calls an @future method (bar()) belonging to another class (FooServices). Ideally in my test class for this Controller (FooControllerTest) I only want to ...
3
votes
2answers
3k views

You have uncommitted work pending. Please commit or rollback before calling out

i have written a future method here is source code @future(callout=true) public static void futureDownloadAttachment(Set<ID> documentsID){ List<SpringCM_Attachment__c> logs = ...
4
votes
1answer
954 views

Saleforce Too many future calls: 11

I have a business logic as follows. 1. A web service class parses XML file containing case data and loads the case to SF. 2. Trigger that on update of case email field make a call to future method ...
1
vote
1answer
363 views

Asynchronous Calls: Order Of Execution In A Test Method

Imagine the following scenario: Trigger myTrigger on User calls a future method which flags Account records. Then a Batch Job must run to process the records. While testing, I am first inserting ...