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
2answers
27 views

How to manage multiple data in input with a Bulk

I've got this problem to solve. I've an apex batch that updates some records all together when a condition is verified. This triggers a Process builder that calls an Apex Class or whatever it might ...
1
vote
0answers
21 views

JSON Post via Apex - PKIX path Building Failed - What am I doing wrong?

This is my first time attempting a JSON POST and I trust your collective judgement. I would appreciate if someone could tell me if I am approaching this correctly or not. I didn't receive any compile ...
2
votes
1answer
40 views

@future method vs Async callout

Some days ago I imported a WSDL into Salesforce and (different of some years ago) it created an Async class (and of course the sync class). So I decided to search on Google how to use this Async ...
0
votes
1answer
24 views

At what point are attachments saved to an object - need to pick them up in trigger

I have a custom object which is created via an online form. It is possible to add attachments and this all works fine - the object is saved and so are the attachments. In the 'after insert' trigger ...
3
votes
1answer
80 views

DML update in @future callout not updating sObject

I've got a Apex class that takes the data from an Account object and uses it to create an account in my company's database by hitting an API. The API accepts JSON then inserts all the appropriate ...
1
vote
0answers
29 views

ConcurrentPerOrgApex Limit exceeded

We are calling Queueable Interface from trigger to make multiple callouts to external systems. The number of callout from Queueable class is 50 as the other system can process only one record at a ...
3
votes
1answer
80 views

Future method cannot be called from a future or batch method: Error

I have two classes class A and class B, I am trying to call Class A's future method from class B's method and I get this error :'Future method cannot be called from a future or batch method'. Class ...
1
vote
0answers
44 views

How to pass the session ID as a argument to a future method?

I have a trigger which calls a future method and the future method uses the ToolingAPI to execute something.But I dont know how to pass the session ID to the future method from the trigger. ...
1
vote
1answer
20 views

Possible salesforce limitation when trying to have a web service callout

Good day everyone, I am trying to sync my salesforce data and php application data. I have read an article from jeff douglas in this link ...
3
votes
1answer
59 views

Difference between Queueable apex and future method

I understand that you could pass collection of Sobjects to Queueable apex classes but not to future methods where we're restricted to only primitive collections. The reason it's not done for future ...
1
vote
2answers
61 views

Why salesforce has introduced Queueable Apex. need some proper clarification

future method behaviour - 1. is executed in their own thread 2. do not start untill resource are available 3. future callout gives us 200 asynchronous soql limit. Why we use Queueable Apex and in ...
0
votes
1answer
42 views

Is it possible to call Batch from a future call?

I was wondering if it is possible to call a batch from a @future method? The reason I am asking as you may have guessed is because I am trying to call batches from a trigger. Eg: Leads are inserted ...
6
votes
2answers
293 views

How to work around the 100 callout limitation?

We need to have the ability to make more than 2999 callouts to a REST service. Currently, we are getting a raised exception when the number of callouts is more than current limit for callouts. Thus, ...
1
vote
1answer
16 views

Execute queue in certain hours only

How can I modify this class to execute only within office hours? public with sharing class AddLeadQueue { public void AddLeadQueue() { System.debug('loaded'); } @future (callout ...
0
votes
0answers
59 views

Test Class for @Future Http POST Callout

I'm having trouble creating a test class for my Future Http POST class. The code works and I'm able to parse the response and update the lead, but I need code coverage. I've looked at the Salesforce ...
3
votes
1answer
51 views

How to solve Async Future Method Inside Loops Issue?

Can any one please help me solving this, The below trigger will create an guid(random_string) and it will be passed to an controller and from controller i'm hitting the Post the data to our URL. ...
1
vote
1answer
24 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 ...
4
votes
1answer
59 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
59 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
68 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
38 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 ...
5
votes
1answer
50 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
35 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
49 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
55 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 ...
2
votes
0answers
45 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
668 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
41 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
61 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
82 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 ...
3
votes
2answers
305 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
241 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
68 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 ...
1
vote
1answer
94 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
87 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
35 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
148 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
96 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
79 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
92 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 ...
9
votes
2answers
518 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
38 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
187 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
64 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 ...
4
votes
1answer
148 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
649 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
81 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
22 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
29 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? ...