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

Using future method in triggers [closed]

Trigger batch size can be 200. If i call future method(callout=true) on every batch object, this will throw limits error or not? If it throw, how can i avoid this?
0
votes
1answer
23 views

Return from a future/Queueable callout

I have to do a callout, but before doing the callout I need to update the cases and use the values from the cases' fields in the request body and then do the callout. I cannot do DML before callout. ...
4
votes
3answers
221 views

How to mock System.isFuture()?

I am writing some tests and I have encounter a problem. In my main app I have the following logic: public static void main() { if (System.isFuture()) { System.debug('Is future'); // ...
-2
votes
1answer
33 views

How to solve read time out error in Apex callout?

Hi all and thanks for reading Got this code: public class SendingZabbixServices{ @future(callout = true) public static void zabbixDoPostFuture(String jsonString, String endpoint){ ...
1
vote
1answer
50 views

Metadata.Operations.enqueueDeployment Callback not allowing Callouts

I have a scenario where I am saving custom metadata for an external API configuration. I want to deploy all the metadata, then after the deploy job is done, make a callout to the API to verify the ...
1
vote
1answer
30 views

Working with large data volume

I have a design question and I want an expert opinion from the group. Here is the use case: Whenever there is any update on the Booking record (let's say change the status to "Cancelled"), ...
0
votes
1answer
29 views

Time delay @future method - need delay for recurring batch process to complete

I have the following requirement and am looking for advice for the best way to process it. We have multiple orgs linked to each other via S2S, with batch jobs running every 10min to pass updates ...
0
votes
1answer
38 views

Apex Job Execution - Multiple @future Methods in the Same Transaction

Could you please help me with the below queries related to Apex Job Execution: If multiple Async request(future methods) are fired in the same thread, it makes the Async job request status as Queued ...
0
votes
0answers
58 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 ...
0
votes
1answer
24 views

Using @future in Beforecontexts

Im working with one of our vendors who has a managed package installed in our org. They are currently using an @future method in the before context of a trigger on the Account object. We are ...
0
votes
1answer
26 views

Update Record Field in callout fired from an AfterUpdate Trigger

So I have a Trigger on Account, on the AfterUpdate event (I've also tried on BeforeUpdate), it launches a SOAP Request to a WebService (via a @future method), and this WebService returns a number that ...
0
votes
0answers
35 views

Salesforce to another SF org: insert Lead + Attachments

I want to send a post request from SFDC org to other to insert Lead in other org along with it's attachments(Selected Attachments) I had sent all the parameters of lead and attachments in single ...
2
votes
1answer
184 views

DML operation Delete not allowed

I am receiving the following errors: DML operation Delete not allowed on List<AccountHistory> DML operation Delete not allowed on List<ContactHistory> List<ContactHistory> conHis = [...
1
vote
2answers
42 views

Does Schedulable comes under sync scope or asycn scope?

I have a schedulable class and I am firing 50 future callouts from that. But as per documentation click here,it is mentioned that in synchronous context we can have 50 future callouts and for batch ...
0
votes
0answers
38 views

Writing test class for Messaging.sendEmail()

I am having an issue while writing a test class for a method that sends a report as an attachment in a scheduled email. My method looks like this: @future(callout = true) public static void ...
3
votes
0answers
196 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<...
1
vote
1answer
124 views

Unit testing Schedulable that calls future method

This has been asked here and here, but I'm not satisfied with the answers. Hoping to gain a better understanding of this. In working through the Apex Specialist Superbadge, the callout portion of the ...
1
vote
2answers
180 views

Trigger How to stop Database.executeBatch cannot be callled from a future method error

I'm calling a trigger after insert and after update, which is calling an Apex Class which hits an endpoint. The triggers are working as expected and firing to an endpoint when a checkbox is selected ...
0
votes
1answer
349 views

Future Callouts and Queueable from a Trigger

I am pretty new to salesforce development. I am trying to make a Callout to the third party API whenever a Account record is created in Salesforce. I tried to make the future callout and didnt realize ...
0
votes
1answer
103 views

Bulkify trigger to future Callouts

I asked another question on the future callouts which was throwing the SystemLimitException, the recommendation was to use the Queable or making the future Callouts bulkified from the trigger. I tried ...
1
vote
1answer
24 views

Using Scheduled Callout response to trigger another callout

I'm having trouble with my current callout/trigger setup. My current architecture is like this: Scheduled job - runs every 5 minutes: global class Scheduled implements Schedulable { global void ...
0
votes
1answer
92 views

Future Callout Throws: System.LimitException: Too many future calls: 51 [duplicate]

I am trying to call the external API endpoint from Salesforce when an account is created. I created a trigger on the Account which looks like below trigger createSegSubSegmentD on Account (after ...
0
votes
1answer
37 views

Trigger Future Callout

I am updating a field on an object from calling future handler in before update trigger, but field value is not get updated on UI. I have to refresh my detail page to see the updated changes. Can I ...
0
votes
1answer
32 views

Assert for Test Class for Future methods without any DML operations

I am trying to write a test class for a @future method which makes a REST callout whose response is just 200 {"status" : "ok"}. It does not make any updates to records. I am finding it difficult to ...
0
votes
0answers
46 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 ...
2
votes
1answer
50 views

The way to execute http callout from apex

I'm a new in integration and I try to make a simple integration, but i'm stuck. Scenario is simple: When record updates or creates, need to pass record data to external system. So I create a class ...
0
votes
1answer
57 views

Issue with using a Class inside a Trigger: “Method does not exist or incorrect signature”

I am currently trying to get this trigger to work: trigger ContactRelatedOpportunities on Opportunity (after insert, after update) { List<Opportunity> Opps = [SELECT Id FROM Opportunity ...
1
vote
1answer
196 views

Trigger firing in @future needs to do callout

We are co-developing some code with a external vendor. We wrote some custom code that when certain field on the contact are updated, it creates a record in a sync object(SyncLog). Then there is a ...
1
vote
1answer
125 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 ...
0
votes
1answer
163 views

You have uncommitted work pending. Please commit or rollback before calling out even if we put DML in future method

I know as per documentation, we cannot perform DML and then callouts from apex class. In my scenario, I have a callout then I am performing a DML which is placed inside a future method and again ...
0
votes
0answers
44 views

how to handle platform events from flow when received as a batch at once

I am creating a flow that uses an Apex action that calls multiple future methods in quick succession and publishes platform events for each of them when they are done. There is also another flow with ...
0
votes
1answer
394 views

can i use multiple annotations in one apex class

can i use multiple annotations in single apex class; like i have the scenario of calling apex class from process builder which is having future method,suppose i am using setup objects and non-setup ...
0
votes
0answers
167 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 ...
0
votes
2answers
174 views

Database.rollback() Method Not Working In Different Transaction?

I have created a very simple scenario where I'm creating a savepoint and trying to rolling back in future method. The behaviour is little confusing - I tried searching it over the net but I didn't ...
0
votes
2answers
276 views

Serialize and deserialize a list of Sobject for Future method

I am trying to pass a list Account records to a future method. Since future can only take primitives, I am planning to serialize and deserialize the Sobject. I tried below: List<Account> acList;...
2
votes
0answers
32 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 ...
0
votes
1answer
44 views

DML in @Future called from Trigger in Batch

I have a after insert trigger on an object that calls a @future method to do a callout to an external system. If the callout fails I want it to update the original object. I am batching up 100 at a ...
0
votes
1answer
79 views

How to make two callouts in sync?

From Trigger on inserting I am making a callout (from method1 of class A) i.e by using @future annotation and updating the field of the same object on which the trigger called, with the values ...
1
vote
1answer
410 views

How to force future method to wait until current thread finish?

I have an apex code which is called from an after trigger. The apex code calls a future method and sometimes the future method runs after the execution of the current thread and sometimes does not. I ...
0
votes
0answers
28 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 ...
0
votes
1answer
29 views

Accessing __history object data in future method

I have a future method inside which two methods are called @future public static void roundRobinAndMail(Id appId) { RoundRobinAssignment(appId); NMEF_EmailUtility.sendEmailFromTemplate(appId);...
0
votes
1answer
157 views

Mixed DML Error in Future method?

Whenever an user is inserted, I am assigning the license(UserPackageLicense) through Future method and also sending an email if we doesn't have enough license number. But I am getting the following ...
0
votes
0answers
362 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 ...
3
votes
0answers
100 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 ...
4
votes
1answer
918 views

Can Process Builder run @future methods?

We're hitting CPU Time Limit Exceeded issues with a class that's being called by a Process Builder. From the SF solutions page, it was noted that one fix for CPU Time Limit Exceeded is to make the ...
3
votes
1answer
1k views

How to check if future method has executed

in my apex code I need to do some calculation only when future method has executed I tried below code to check if future method has executed: public static void anotherMethod() { while('Completed' != ...
1
vote
1answer
128 views

How can I use queueable Apex instead of a future method with arguments?

I have an @future class, SubmitOnApproval which is called when an opportunity is approved. This class is below: public without sharing class SubmitOnApproval { @future public static void ...
1
vote
1answer
33 views

Capturing HttpResponse StatusCodes

I'm trying to capture a HttpResponse StatusCode in a @future method so I can then send it to an email to alert a dev of a possible issue and also alert the Salesfroce user of the error. I have found ...
2
votes
1answer
33 views

Need advise on callouts and inserting/updating new records from external system

We have an external application where few records gets updated or created on daily basis. We already implemented inbound calls to salesforce but it is scheduled for once a month. We need to schedule a ...
0
votes
1answer
107 views

Using HttpResponse in a seperate class from future

I have written a trigger that calls a class which contains a future method and I need to use the response to update a field. Is there anyway to capture the HttpResponse in a separate class? public ...

1
2 3 4 5
8