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

How to get Box Folder ID from boxtoolkit

In my custom object , the Box did create a Custom Field called Box Folder ID , but there is no information in this field that I can access. I am trying to include a logic to get BoxFolderID , If the ...
user139696's user avatar
1 vote
1 answer
48 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
  • 19
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
65 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
345 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
73 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
46 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
66 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
82 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
40 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
237 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
59 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
80 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
35 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
  • 450
0 votes
1 answer
359 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
0 answers
45 views

Update an Opportunity from a future callout method

I have a future method that posts data to an API, and IF the response2.getStatusCode() == 200, I would like to update a field on the opportunity. However, I get this error message: System.DmlException:...
potato46's user avatar
0 votes
1 answer
82 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,402
1 vote
3 answers
519 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
  • 51
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
38 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
87 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
198 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
  • 6,982
0 votes
1 answer
2k 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
  • 803
0 votes
1 answer
292 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
200 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
3k 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
369 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
272 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
86 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
357 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.8k
-1 votes
1 answer
525 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
545 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
946 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
446 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
626 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
189 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
419 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
200 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
138 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
759 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
9k 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
502 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
107 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
  • 756
1 vote
2 answers
339 views

Query third-party api on lead update and write response to new field on same object

Folks, I am in need of some apex wisdom please! I've experience in other programming languages but trying to get my first apex trigger and class set up. My overall aim is when a specific field on the ...
Eoin Clancy's user avatar
3 votes
2 answers
2k views

Why would a future method not show up in debug logs?

What are some possible reasons a future method wouldn't show up in the debug logs? @Future(Callout=true) global static void myFutureCallout(Id testId){...
Olivia's user avatar
  • 3,451
2 votes
1 answer
4k views

Calling Future Method From Trigger

I am pretty stumped - I have a trigger on a custom object that calls a helper class that calls a future callout method. When I call the trigger, the helper class is called but I can't seem to get into ...
Olivia's user avatar
  • 3,451
0 votes
2 answers
1k views

DML in a future method will be rollback if after there's a throw exception

My classA calls classB which calls a future method inserting an object, later in classA it throws an exception, and I saw my DML in future method is also being rollbacked. Is there anyway to commit ...
yozhang's user avatar
  • 43

1
2 3 4 5
9