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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How to write test class for future httpcallout which is written [duplicate]

I have a class when QuoteAwsAccountId Object is created or AwsAccountId value inside the QuoteAwsAccountd object which is a string then it should make a get call to external api using Named ...
surya k's user avatar
1 vote
0 answers
56 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
0 votes
0 answers
26 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,855
1 vote
2 answers
42 views

I want to write a unit test that can assert an enqueued job called a specific @Future function

To start, let's say I have this simple unit test: @isTest public static void shouldCallFutureMethod() { Test.startTest(); System.enqueueJob(myQueueableJob); Test.stopTest(); } Given ...
J. Dufresne's user avatar
0 votes
1 answer
52 views

System.QueryException: Record Currently Unavailable

Im getting the following error: caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by ...
Thomas's user avatar
  • 2,310
1 vote
1 answer
66 views

I have a trigger that makes callout to external system in a future(callout=true) but does not run immediately. Where is this callout queued?

@future(callout=true) public static void makeCallout() { System.debug('Hello World-1!'); // Instantiate a new Http object Http h = new Http(); String endpoint = 'https://******...
Patrick Rantsho's user avatar
1 vote
1 answer
63 views

Do queueables have their own governor limits?

I have a class that makes consecutive API calls. I set the timeout to the maximum value allowed by Salesforce (120 seconds) however sometimes these are timing out because of the API taking way too ...
sfNewbie's user avatar
0 votes
0 answers
21 views

Manager Id is not updating whenver the user is deactivated using apex trigger [duplicate]

My implementation: trigger userTrigger on User (after update) { Switch on Trigger.OperationType { when AFTER_UPDATE { userHandler.checkUser(Trigger....
Sridhar's user avatar
  • 61
0 votes
0 answers
23 views

Wrote a Future method where Testcoverage is not 100% [duplicate]

Testcoverage class : @isTest public class AccountCalcultorTest { @isTest public static void contactcalculatorTest(){ List<Account> accAdd = new List<Account>(); ...
Naveen's user avatar
  • 1
1 vote
1 answer
80 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
3 votes
2 answers
551 views

Using Apex, how do I monitor the daily @future limits?

This support article indicates that I have a limit of 250k @future methods per day. However, I can't find the corresponding Limit class function to monitor this limit. I've tried: System.debug(Limits....
Jackson Sardello's user avatar
0 votes
0 answers
109 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
48 views

Test class for @future method called by trigger not working (Methods defined as TestMethod do not support Web service callouts) [duplicate]

I have a trigger on Account that makes a call to an apex class: trigger AccountAddressTrigger on Account (after insert) { Id patientAccountRecordTypeId = [SELECT Id, RecordType.DeveloperName FROM ...
happyLion's user avatar
0 votes
0 answers
83 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
118 views

Change Data Capture (Async Apex Trigger) vs @future method in Trigger

What is the difference between using the Async Apex trigger and @future methods? Why use Async Apex Trigger when we have @future method to separate the thread from the main Trigger? The only ...
Daniel Deepak's user avatar
0 votes
1 answer
133 views

'uncommitted work pending' even when all DML statements have been deactivated

Our system is pretty complex with DML statements, call-outs and future methods everywhere. After adding some more functionality, I ran into the dreaded 'uncommitted work pending' error. It had been a ...
Sander de Jong's user avatar
-1 votes
1 answer
378 views

I need to get the data in a trigger after an api callout with @Future methode

I need to get the fields from the api and update them in the salesforce object , so i need to callout an api . Here is my trigger trigger getEntrepriseData on Account (before insert,before update) { ...
M.W Sassi's user avatar
0 votes
1 answer
124 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
142 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
-1 votes
1 answer
37 views

Getting Error in This Test Class

@isTest private class LeadUpdateTriggerHandlerTest { @isTest static void testHandleUpdate() { // Create test data Lead testLead = new Lead(FirstName = 'Test'...
user131546's user avatar
0 votes
0 answers
15 views

When will Aysnc method or Class will execute? [duplicate]

We have a case object subject field. When the case is created, Trigger fires and update the subject, then flows fire to update subject again..Now i have a future method or Queueable class or batch ...
Sukruti's user avatar
  • 462
0 votes
1 answer
529 views

After Update and Insert Trigger with Future Method Causing DMLException

I'm trying to update a field on the account field with a trigger using after insert and update. I am using a future method to make a callout to a rest API to get the rate of BTC in USD. My issue is ...
Carraig's user avatar
0 votes
1 answer
110 views

Reload Visualforce Page after Future Method

I have a visualforce page that creates a record, and then assigns a permission set to the User and updates some of the fields on the user. The update for the Permission Set Assignment needs to be a ...
thinker's user avatar
  • 1,442
1 vote
3 answers
640 views

Does Queueable Apex guarantee preventing deadlocks if implemented correctly?

I just want to confirm my understanding is correct of whether or not Queueable Apex will alleviate an issue I am having with @future methods. Right now, in my org's account trigger handler class, we ...
Chris's user avatar
  • 61
3 votes
2 answers
1k views

Why can't we use non-primitive data types in future methods?

Why can we use non-primitive data types in Queueable and not in Future methods when both are async processes? The reason that salesforce has documented is - 'The reason why sObjects can’t be passed as ...
SFDC Salesforce's user avatar
0 votes
1 answer
40 views

Can future() methods be chained in a similar manner to batch jobs, to manage sequencing?

I have a trigger that hands off its trigger context to a queueable class, so that I can them make outbound REST calls to initiate campaigns. Trigger > queueable > processorClass with @future ...
Duncan Stewart's user avatar
1 vote
1 answer
88 views

Too many DML statemnts 151 in Future apex

I am getting Too many DML statemnts 151 IN MY aPEX JOB SECTION Due to this code public class LeadFuture_TradingAccUpdate { @future(callout=true) public static void updateTradingAccounts(Set&...
Yogesh Sakat Aphidas's user avatar
0 votes
1 answer
234 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,030
0 votes
1 answer
3k views

Future methods in flow actions

I've two flow actions which both make HTTP callouts. The second action depends on the output of the first. However, since future methods don't return a value, I'm unable to use the second action in ...
vishesh's user avatar
  • 763
0 votes
1 answer
312 views

To block the creation of Account record based on apex callout response

My requirement is I need to block the creation of Account records based on apex future callout response TriggerCode trigger AccountTrigger on Account (before insert) { Set<Id> accLst = new ...
Athira Venugopal Aphidas's user avatar
-1 votes
1 answer
276 views

Multiple Web Callouts In Scheduled Apex

I'm trying to get some additional information on specific phone numbers in my database using web callouts. I won't hit the governor limits as it's going to be less than 100 numbers per day. I'm also ...
user121746's user avatar
0 votes
2 answers
4k views

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

I'm getting the below error while running the test class. Can anyone help on this please? Error : System.DmlException: Insert failed. First exception on row 0 with id a057h000002BqVUAA0; first error: ...
user avatar
0 votes
2 answers
450 views

Future method executing (success), but not working

I bulk-updating phone numbers on objects, following method working on single or multiple numbers, but when I delete conditions in query for low amount of records, its exception CPU time exceeded. So I ...
jur1s77's user avatar
  • 47
1 vote
0 answers
276 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
2 answers
89 views

Need to know if I should switch class to batch or queueable or do something totally different

I have a method using @future, that seems to have "outgrown" that. Its a method that is kicked off by process builder after a nightly external job comes in a updates a bunch of SF records. ...
excelDvelop's user avatar
0 votes
1 answer
418 views

Custom exception not being caught in future method

I have built an Apex integration with a customer's custom API. All API responses are of the form: { "code": 3000, "message": "SUCCESS", "data": { &...
Jason Clark's user avatar
  • 11.9k
-1 votes
1 answer
602 views

How can I send an email with a salesforce report attached?

I'm try to scheduler email send with a repor attached, but when i received the email, appear the next error in the file: I'm use the nex Apex code: global class Exporter implements System.Schedulable ...
Michelle Soto's user avatar
0 votes
1 answer
606 views

How to test schedulable class with future callout method

I'm trying to run this test and it keeps failing. The error I'm getting is "System.QueryException: unexpected token: 'null'" so it's related to my lstContacts SOQL query, but I can't figure ...
JVZ's user avatar
  • 17
0 votes
1 answer
1k views

Getting content from within triggers is currently not supported

I am sending a pdf in an email when the opportunity is created on updated which works fine. Now when the opportunity is created through batch so its throws the error future method can not call future ...
relcey's user avatar
  • 13
4 votes
0 answers
507 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
0 votes
1 answer
667 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
-2 votes
1 answer
1k views

How to test Future Method from anonymous window

i'm tring to insert phone field from future method, so i'm passing account id from anonymous window. But i'm getting error. code :- public class futureTest { @future public static void main(...
SATYAM KUMAR's user avatar
0 votes
2 answers
200 views

Why Places field on account object is not getting updated in the UI after making callout from trigger using future method?

I have made two custom fields 'Pincode__c' of type text and 'Places__c' of type Long Text Area.I am inserting account record by providing 'Pincode__c' value and want the custom field 'Places__c' to ...
Rajesh's user avatar
  • 121
1 vote
1 answer
459 views

PUT method of @future(callout=true) gives us 403 Forbidden error for the added remote site

I'm working on the trigger for the custom object, when we update the custom mail field, it has to be updated in the third-party API (which I've added in the remote site settings). As we know @future(...
Sivaskandhan Kumaraguru's user avatar
1 vote
0 answers
225 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
0 votes
4 answers
148 views

httpCallout @future

can please someone tell me what I am doing wrong. I am only able to get 30 percent test converge. I am unable to get test converge for the http. Any suggestion is much appreciated Thank you! public ...
Alex 's user avatar
1 vote
1 answer
813 views

Invocable apex REST POST

I'm an admin who pretends to be a developer every once in awhile. I'm trying to use a Flow to initiate a REST POST callout. From other research, I understand this may need to be done with a future ...
chopps's user avatar
  • 11
2 votes
2 answers
12k views

Getting error System.AsyncException: Future method cannot be called from a future or batch method: when I am calling future method from a trigger

When I am calling future method from a trigger then I am getting error USER_DEBUG caused by: System.AsyncException: Future method cannot be called from a future or batch method: ExampleFuture....
Rajesh's user avatar
  • 121
1 vote
0 answers
588 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
-2 votes
1 answer
109 views

AsyncApex Scenarios [closed]

I am writing a few Ques for which i have found conflicting answers on Internet. Also I have written my Answers after researching on Internet, but wasnt 100% sure, hence posting these here to clear ...
Mohit K's user avatar
  • 766

1
2 3 4 5
10