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
33 views

How to test schedulable job with future method?

I have daily job that makes callouts and updates some records. There is @future method invocation in execute() method. I have created test according to this guide: https://developer.salesforce.com/...
0
votes
0answers
10 views

Auto-generate multiple Remedyforce Incidents and Tasks through back-end

I am attempting to create Remedyforce Incidents and Tasks upon the approval of a request in another custom Salesforce app we are using. However, I am only able to create 4 Incidents in one instance ...
2
votes
3answers
148 views

System.CalloutException: You have uncommitted work pending during Test for callout in @future method

SOLUTION An object has workflow rule that sends an email and it was not mocked EDIT I am simply trying to test future method that invokes SOAP service, but I get an exception. EDIT 2 I have @...
1
vote
1answer
20 views

Trigger : storing data from external request

I am writing a SF apex trigger on Opportunity (insert, update) that calls a class function that sends HTTP requests to some Groupcamp instance. … Quick schema so you're not lost : SF trigger on ...
0
votes
1answer
42 views

Stop code but continue executing future methods [closed]

I want to stop the execution of my application but allowing only the @future methods to continue to run. Is it possible to do this?
0
votes
2answers
18 views

Flag contacts which are being converted from lead

The Problem: We have some functionality that lives on both the lead object and the contact object. If someone, either a lead or a contact, requests a demo, the record gets time-stamped by our ...
0
votes
0answers
18 views

Performance degradation in salesforce sandbox - batches and asynchronous are taking too long time

We are running start of day and end of day jobs before and after the business hours, but from around 4 days we are observing even without any data sets the batches are taking too long to run. ...
2
votes
1answer
22 views

Return a response after calling a REST point created on salesforce, while the REST point is calling a @future method

I have crated a RESTful endpoint on my sandbox. When it is called with the proper input it creates a new contact and then decorates a custom response class I created for that purpose and at the end it ...
1
vote
2answers
36 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
29 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
78 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 class....
0
votes
1answer
25 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
108 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
59 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
95 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 A:...
1
vote
0answers
60 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
21 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 http://blog.jeffdouglas.com/2009/03/16/restful-web-service-...
4
votes
1answer
69 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
95 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
51 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
318 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
20 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
77 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
73 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. ...
2
votes
1answer
42 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
79 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
19 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
78 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
84 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
52 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
52 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
43 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
50 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
61 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 ...
3
votes
0answers
64 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 ...
5
votes
2answers
1k 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
43 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
86 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
106 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 ...
4
votes
2answers
321 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
316 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
73 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
113 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
111 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
38 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
193 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
114 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 folder,...
3
votes
0answers
90 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
108 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
586 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 planning ...