Skip to main content

Questions tagged [future]

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.

75 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
2 answers
2k views

Preventing Recursive Future Calls

I have a usecase where when an account is updated, an after update trigger is fired. This trigger will call a future method which will call a SOAP API to assign the relevant territory assignment rules....
nica's user avatar
  • 1,410
4 votes
0 answers
513 views

Blank PDF using getContentAsPDF in future method

I am having an issue in production with a specific Profile (a clone of the System Administrator) that generates Invoices via a @future call resulting in a blank PDF creation. Below is a simplified ...
Scott's user avatar
  • 41
4 votes
0 answers
135 views

compiling error during runtime for class that compiles fine

I'm getting the following error (below) while executing a future call. The mentioned class compiles and saves fine upon retesting. Any idea why this would be occurring at runtime? It seems to work ...
Phil B's user avatar
  • 5,026
4 votes
0 answers
191 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 ...
Nils Rosen's user avatar
4 votes
1 answer
980 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 ...
Todd Sprinkel's user avatar
4 votes
1 answer
4k 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 ...
Chris's user avatar
  • 1,675
3 votes
0 answers
2k views

Executing multiple callouts from a future method

I have a problem when I try to execute multiple callout from a method of an Apex Class. The method code is the following: @future(callout=true) public static HttpResponse makeCallout(){ List<...
Valentina's user avatar
3 votes
0 answers
227 views

Sporadic "Insufficient Privileges"

We sometimes receive screen shots from business users indicating they are seeing "Insufficient Privileges" errors. These errors come up in a variety of contexts, but they appear to mostly be ...
Matthew Souther's user avatar
3 votes
0 answers
112 views

Failures during bulk insertion of records not executing @Future methods

I have a requirement to populate the GeoCode whenever the Account records are inserted or updated. I have written after insert, after update trigger to fire a geolocation google API it works perfectly ...
konatham swathireddy's user avatar
3 votes
0 answers
812 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 ...
Paul's user avatar
  • 31
2 votes
0 answers
93 views

Apex Test not able to execute Queueable and Future in same user context?

Scenario -> Queueable calls a Future method In business process the Queueable calls another future method and future executes in same user context as its having some CRUD and FLS checks. Now when ...
Nagendra Singh's user avatar
2 votes
0 answers
44 views

Unit test false positives because of future callout triggers

Background I have the following Apex class method which is called as a result of a trigger on a custom object, MySet: @future (callout=true) public static void exportMySet(string setId) { // do ...
ProgrammingLlama's user avatar
2 votes
0 answers
1k views

All attempts to execute message failed, message was put on dead message queue

I have a process that is chaining Queuables using a future method similar to this: public class MyQueuable implements Queueable{ public virtual void execute(QueueableContext context){ //do ...
NSjonas's user avatar
  • 10.2k
2 votes
0 answers
87 views

How to resolve the problem of refreshing standard page multiple times until callout completes?

We are using opportunity custom button to populate the value of a field based on the response form future callout. In order to receive the value we had to keep refreshing the opportunity page until ...
Priyalakshmi's user avatar
  • 1,456
2 votes
0 answers
811 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 ...
user3702503's user avatar
2 votes
0 answers
510 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 ...
user3702503's user avatar
1 vote
0 answers
65 views

Unexplained pause in Apex transaction

Inside a future method we are inserting some records and we've come across a problem when Apex takes about 4.5 seconds delay between 'Executes all before triggers' and 'Runs most system validation ...
Anton Solomin's user avatar
1 vote
1 answer
83 views

List of Strings is empty in @Future-method

So I have a list of Strings which is populated with Ids (in form of Strings) in the batchProcessSchedules() method. By reaching the limit (size) it will pass this list, together with another list and ...
FelixHVD's user avatar
1 vote
0 answers
278 views

Condition membership of experience site based on permission set for users created with createUser handler code

We have created handler code which works great for a community when the community is set to allow membership based on the profile that is also assigned by the handler code. We have a requirement ...
Jake Durell's user avatar
1 vote
0 answers
230 views

Apex Cpu limit exceed error in future method

This future method give me cpu limit error.Using this future method i get the parent account Id and using that fetch the child account and rename it.can anybody help me? @Future private static void ...
Basu's user avatar
  • 23
1 vote
0 answers
605 views

Issue in deserializing of List<Messaging.SingleEmailMessage>

I would like to send email with future apex. Because of future method can't access list of Messaging.SingleEmailMessage, I'm serializing it and pass string to future method. But when I deserialize it, ...
Vonahclom's user avatar
1 vote
0 answers
56 views

Enqueuing chained queueable instances that trigger deployment jobs don't perform deployment

I've got problem with executing deployment jobs inside queueable instance. Background: Exchange rates data is divided between two endpoints a and b. That's why I need to make a callout twice. ...
janlan's user avatar
  • 125
1 vote
1 answer
710 views

Unit Testing code with Database.savepoint and a queuable apex or future callout

Here is the scenario I'm running into. Is there any way to unit test a rollback where dml is performed followed by an async process? I understand that wrapping savepoint in if(!Test.isRunning()) is ...
Chris C's user avatar
  • 271
1 vote
1 answer
2k views

System.CalloutException: Received fatal alert: handshake_failure

I am trying to do a salesforce integration US Census. When I run the below code I am getting following error "System.CalloutException: Received fatal alert: handshake_failure" I have a self signed ...
Tamil's user avatar
  • 724
1 vote
0 answers
763 views

Future Method cannot be called from another Future Method

I have a platform event trigger that calls a method in a class that is annotated with @future. This future method makes an external REST api call to get some data and updates values on the ...
user1669296's user avatar
1 vote
0 answers
1k views

Run Queueable as sequence

Good day Everyone, I have a trigger that will call a Queueable. The process looks like this : Trigger : for(User userData : Trigger.new) { if(Limits.getLimitQueueableJobs() - Limits.getQueueableJobs(...
Hope's user avatar
  • 1,273
1 vote
0 answers
749 views

User Automation and Future Method and Permissions Issue

I am stumped on a problem and was hoping someone could spur some thought. I have two users who have different profiles. The System Admin profile is able to get through a Future Method and a ...
Olivia's user avatar
  • 3,471
1 vote
1 answer
358 views

Creating user's with batch apex which will invoke a trigger and a future method

I have a trigger on user object which runs on the creation of new users of a particular profile and also has a future method called for assigning user some id's So my doubt is if I insert the user's ...
Ishan's user avatar
  • 539
1 vote
0 answers
183 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 ...
Morgan Marchese's user avatar
1 vote
0 answers
288 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 ...
huchister's user avatar
1 vote
0 answers
11k 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 ...
shunjieNeo's user avatar
1 vote
0 answers
705 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 ...
Brian Casey's user avatar
1 vote
0 answers
430 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 ...
Rajendra Singh Nagar's user avatar
1 vote
0 answers
6k views

Apex 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. IF the number of call outs I need to make is one then future method is triggered. ...
duygu's user avatar
  • 11
0 votes
0 answers
29 views

Web callout 1 record at a time - Future vs Platform events

So I have a situation where the third party web callout can only process record at a time. From SF perspective, if I would like to mass process records and send them to the external web service. I am ...
SEuser's user avatar
  • 1,847
0 votes
0 answers
126 views

I have two Queueable Jobs running in a transaction how to resolve it

On Order Product object I have an integration with a 3rd party system, which sends data the 3rd party whenever the Order Product through Queueable class. Now I am trying to insert a set of records to ...
Akshay Vasu's user avatar
0 votes
0 answers
93 views

@Future method is not getting called. No logs, no exception no errors. When records are inserted through REST API call from an external system

Orders custom object have a lookup on Contact. Each Order will have a corresponding contact. A contact can have multiple orders. When an order's is inserted through Salesforce or any tools for ...
Janardhan Kumar's user avatar
0 votes
1 answer
144 views

How can I convert normal triggerHandler Method to Future method?

Im learning about Future methods so wanted to covert my triggerHandler method to Future method...where Im trying to insert contact on every user insert. but im getting an issue called "Future ...
Sajid's user avatar
  • 13
0 votes
0 answers
167 views

Question on beforeUpdate or afterUpdate trigger in Salesforce

I have some doubts on whether I should be using a beforeUpdate or an afterTrigger for the scenario enlisted below. Any pointers would be very helpful. Thanks in advance. I have a custom object ABC ...
Bharath Sridhar's user avatar
0 votes
1 answer
246 views

Loosely coupled Queueable framework

Edit: Sorry for the confusion! I’m trying to use this generic framework I mentioned below the error message I’m getting from my code which is calling a standard queueable class. So, my question: I ...
Nick's user avatar
  • 7,064
0 votes
1 answer
678 views

After response from future callout how we can update the field value in record, can you please assist

here I'm calling below class from the trigger and getting response from external system as well whether my regNo is blacklisted or not, but after saving the record how we can update the status basis ...
Harish's user avatar
  • 11
0 votes
0 answers
723 views

Was trying to get the Data from the API Endpoints and Insert into Salesforce Org

I am new to the Salesforce Developer and was trying to do something where I was trying to fetch the data from the API endpoints and Insert into my Object of salesforce Org. Using the Future ...
Aayush Aman's user avatar
0 votes
0 answers
1k views

How do I write test methods for a @future method in a SandboxPostCopy class?

My team uses a sandbox for user onboarding, so I wrote a SandboxPostCopy class to populate the training sandbox with sets of records and create test users on refresh. The class compiles and, as far as ...
E. Csongradi's user avatar
0 votes
0 answers
78 views

How do I get the records from the database after they have been added using the "future" method?

I have a task in front of me: for the time period specified by the user, you need to get currency rates from a third-party service and display the results on the screen. I wrote the following code: //...
unique user's user avatar
0 votes
1 answer
653 views

How to achieve Asynchronous Apex with Aura Components? (NOT Callouts)

I have a working Aura Application with a requirement of showing heavy data inside of many lightning datatables based on the LoggedInUser. It works fine for majority of the users but for few, the data ...
apz's user avatar
  • 452
0 votes
0 answers
145 views

Executing a callout at the end of a chain of methods operating in @future context

I have a callout method that is executed as the last step of a long chain of methods when a record's status get changed to "completed". Early in this sequence, we have a method that we have ...
Trevor Gill's user avatar
0 votes
0 answers
903 views

Call a @Future method with the Process Builder

I am attempting to call a class with a @Future method by using Process Builder. In order to do this I believe I need to initially call a class with an @InvocableMethod to in-turn call that @Future ...
Zoom_v's user avatar
  • 3,894
0 votes
0 answers
371 views

How do I troubleshoot @future jobs that simply vanishes?

I am working in an environment where some @future jobs seems to vanish. It's a quite complex org so I'll try to explain as clearly and detailed as possible. When a lead changes Status a new record ...
Muxlix's user avatar
  • 1
0 votes
0 answers
893 views

Alternative of Batch calling Future method

I've looked around to try to find some posts on this and there are many but none that address my specific question (that I could find). I am trying to call a @Future method inside a for loop in my ...
Haseeb Akhtar's user avatar
0 votes
0 answers
47 views

Bulkified trigger giving error on data import: Z4PAccountAddressTrigger: System.LimitException: Too many future calls: 51

I have a future call that gives me the error: System.LimitException: Too many future calls: 51, while importing multiple record with data loader. I did some googling on the limitations of future calls ...
Thomas's user avatar
  • 2,310