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

1
vote
1answer
12 views

testing future with callout from schedulable class

I'm definitely missing something. How do I test Schedulable class with a future method that does a callout?I have 100% code coverage of the Schedulable class but 0% of my service.The test fails as no ...
3
votes
0answers
36 views

Is there a way to retrieve the oldMap of a trigger in a future method?

This could be quite a dumb question though, I would like to ask is there a way to retrieve the oldMap of a trigger in a @future method? In the below code please refer the collection "oldReportsMap", ...
1
vote
0answers
15 views

Turn on User TraceFlag from APEX Class

I am currently having difficulty to add a new traceflag from APEX Trigger or Class. Now, I've tried to use tooling API and using rest API call to activate a traceflag whenever new custom object gets ...
3
votes
0answers
38 views

How to execute and run a Trigger as a System Administrator

To start, I know that you can only use System.RunAs with test methods. Now that we got that out of the way, I have a trigger that is executing an operation that the current user can't do with their ...
2
votes
1answer
45 views

The future of Async Apex - everything Queueable?

I know that this is a somewhat opinion based question but there is definitely interest in the community in where the Roadmap goes. Do I get the blogs and communities and blogs right that we are ...
1
vote
2answers
31 views

Any issue if too many future calls are set

I am sending email from my apex code using sendgrid API and after every call I am updating a flag in my object marking that email is sent. I am doing DML after every callout because somehow any error ...
4
votes
1answer
41 views

A callout pattern idea

I just came up with the following pattern for making callouts. It's loosely based on Dan Appleman's Scheduler pattern. Has anyone out there has used or dismissed this? Why did you dismiss it? ...
0
votes
1answer
23 views

Delay run an After update trigger

I have two after update triggers T1 , T2. Can I do their run sequencial so that T2 should run always after T1?
1
vote
1answer
48 views

System Assertion not returning the right result in an @Future method

I have a class that updates leads and sends emails to the Lead owners, this part works just fine. Now that I'm writing the Test class, in my test the lead I create doesn't get updated. Why could that ...
1
vote
1answer
35 views

Getting System.CalloutException: You have uncommitted work pending. Please commit or rollback exception even after @future call

I have done following things and i don't think i should get his Exception - 1) Logger.debug(LoggingLevel.INFO, 'Custom Message'); - A custom logger class 2) after above logger a call out to other ...
1
vote
0answers
33 views

Future callouts when trigger fires from batch job

I have a batch job that goes through a list of a custom objects and updates certain field. This is working correctly. The custom object is part of a managed packaged. On the custom object is a ...
4
votes
2answers
214 views

Error: Future method cannot be called from a future or batch class [closed]

My requirement is getting latitude longitude from google map for that i wrote trigger and used @future callouts. now i need to run batch class to update contact records but contacts not updating ...
0
votes
1answer
40 views

Future method can not be invoked

In the following code the future method is not being invoked. public void setLeadStatus(Account accountObj) { String companyName = accountObj.name; String accountObjWebs = accountObj.Website; ...
1
vote
1answer
38 views

Trigger Help — “Too many future calls: 51 Status code:16”

I'm trying to bulk upload 20,000 Locations (Location__c) which are cities with additional information such as state, country, lat, long, etc. When I try to upload them, I get the following error ...
1
vote
1answer
52 views

Http callout test class “uncommitted work pending” error with no clear cause

We have method EnrollmentUtil.createNewEnrollment which contains a http callout on create of custom object Enrolment__c, and a test class to test this method. I'm trying to figure out how this class ...
2
votes
2answers
288 views

Do asynchronous methods run in parallel?

The short question is - do future methods run in parallel, or sequentially? I am wondering if race is possible in Salesforce. Let's say We've got some singleton class S that we want to call from some ...
2
votes
1answer
127 views

“System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names present”

I'm facing “System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names present” error when I try to make a callout to an external webservice. Problem ...
2
votes
1answer
54 views

@remoteaction or @future

I have a trigger which run on insert of a parent record. The working for trigger is like when parent is inserted all the child related to parent get inserted and when child get inserted all the grand ...
0
votes
1answer
65 views

ChronJob Table Locked, Preventing Active Job from Rescheduling Itself

I have a scheduled job, which updates Setup and non-Setup objects. The scheduled job performs immediate changes on the non-Setup objects, and (in same run) executes a method using the @future ...
0
votes
1answer
57 views

Relating Contacts from Invitees via Trigger

I want to dumb down the multi person calendar events in Salesforce so a Salesperson can go to the invitees on the bottom and just enter all the people - users and contacts in one place. If one adds ...
-1
votes
1answer
29 views

How long will take to run future method?

How long will future method take to run in a class. I'm executing a class which consist one future method. The class is executing is fine but i'm waiting for future method result since long time ago. ...
1
vote
1answer
95 views

unsupported parameter in future method

I am trying to create a future method and pass in the following parameter: @future private static void myMethod(Map<Id, List<String>> userMap) { I get unsupported parameter type. I ...
1
vote
0answers
74 views

Handling Asynchronous Responses from Box.com

I'm using the Box Toolkit for Salesforce. As you know, in Apex I have to make asynchronous calls to Box. My problem is that sometimes when am performing multiple operation, such as creating a ...
3
votes
0answers
63 views

Calling APEX out of JavaScript the APEX-API Version is ignored

I run in an issue with calling APEX out of JavaScript, when i call my APEX class, the class is executed with API-version 34.0, but in the metadata of this class is the API-version set to 27.0. I need ...
0
votes
1answer
75 views

Compile Error: Method does not exist or incorrect signature:

I'm working on a schedulable class that makes and http callout, I need my schedulable method to start my @future method with my callout. The error I'm getting is " Method does not exist or ...
8
votes
3answers
395 views

GetContentAsPDF from Batch Apex and Trigger fails with new Update

[Salesforce Update] The critical update named “PageReference getContent() and getContentAsPDF() Methods Treated as Callouts” was scheduled for auto-activation in Winter ’16. To allow for ...
1
vote
1answer
34 views

Test Class on @future method won't pass

I'm trying to finish my test class for a @future method, but I just can't seem to figure out my syntax. We have an automated system that creates User records. We've added a trigger than uses the ...
2
votes
1answer
139 views

Future Method: Too many future calls : 51

Working on a future method to post values to external web service. But since there is a limit of 50 callouts per invocation, I am getting error "Too many future calls : 51". Cases are loaded into ...
1
vote
1answer
56 views

How to test @future methods [duplicate]

I've the following services: public with sharing class LibraryService { public static void remove(String jsonString) { Library__c library = [ SELECT Id, ilms__Library_Name__c FROM ...
3
votes
1answer
100 views

Trigger fired by future function does not support callout

I'm developing an integration that makes an HTTP call to an external system from SFDC. The entry point for this code is an opportunity trigger. After a user updates the opportunity, my trigger fires, ...
2
votes
1answer
443 views

Call Queueable from future method

I have a use-case where I need to execute some logic in async mode and I found that using Queueable Interface I can achieve that. But when I am trying to the use the Queuable Interface, some issues ...
2
votes
2answers
64 views

@future callout + button + multiple clicks = multiple callouts instead of one

I have a button(with Javascript for call apex class) in Opportunity object. I have Apex Class with @future Callout for sending information about Opportunity to Jira. And it's work fine, except one ...
0
votes
1answer
19 views

Chatter Event without a Related To Onto the User's page

I have a trigger that collects Events without a related to and pushes them to a Future Method class - because events added via outlook don't have a WhatId! - and then publishes a Chatter post on the ...
0
votes
0answers
28 views

Future method not being invoked

I have created a future method that will update accounts in seperate batches. The client sometimes gets a CPU timeout. Anyway, my future method is not being invoked. Does anyone have an idea why? ...
0
votes
1answer
42 views

Document upload parallel through Apex - Design review

I am doubtful whether I am going in the right direction. My requirement is to upload all the documents from Salesforce to my local storage space. I have a button that triggers the following function: ...
1
vote
2answers
60 views

Uncommitted work pending from a non-DML access

I'm trying to upload documents to a third party server. This is what I've come up with currently. I got several methods to preprocess the upload process and after that I run a loop to upload the ...
0
votes
3answers
124 views

Test class for @future class

Hi I have the below trigger and future pls help me on how to write Test class for this:- trigger Contactcallout on Contact (after update) { Map<Id, String> m = new Map<Id, ...
2
votes
2answers
254 views

Future Method Static

I am new to Salesforce and hence a lot of silly questions. What is the rational behind defining future methods as Static? I mean has these methods been not static what harm would have they caused?
1
vote
1answer
153 views

update records through a @future callout method inside a before/after update trigger fires

I have a trigger that fires when the address has changed on a record. I make a callout to Google API to gain the longitude and latitude information that I then want to put inside of my record. When ...
1
vote
2answers
115 views

Getting @future method complete before startTest()

Is there a way to wait for all @future method completes before starting the test? I think Test.startTest() does not wait for future methods. I need the future method to be done in order to setup data ...
0
votes
3answers
32 views

Data in a Custom field getting deleted itself

I have a field called Target Check on Case object which was updated by future call from a AfterInsert and AfterUpdate trigger. Since it is a future method, there is a 2-3 second delay and I have ...
0
votes
0answers
77 views

How can I navigate to a specific URL from inside an Apex Class (Controller Extension)

I have an Visual Force page which when visited launches an Apex Callout, when this callout is done (Contact object has been created/updated) the original VisualForce page needs to update to reflect ...
2
votes
2answers
101 views

During deployment, Test Class for trigger of @future method with callout returning “Uncommited work pending error”

So I'm familiar with the error System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out but I'm stumped with this one! I have a call with a ...
3
votes
2answers
367 views

UserInsertUpdate: System.LimitException: Too many future calls: 51

I have a trigger on User that after it's inserted or updated, I want a contact for that user to be created. For example, if a new user Fred is created, I also want a contact created with Fred's ...
1
vote
0answers
40 views

Saving search engine parameters: design consideration

I have a custom search engine for my limited users. These users have a custom front end and we cannot have them seeing the objects through the standard UI. One of the new requirements that I have is ...
2
votes
2answers
406 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
26 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
236 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
35 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
90 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 ...