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
0answers
26 views

Restrict user deactivation if Account is owned by the user and send an Email with details

please help. I am new to SFDC please help. Requirement: Restrict user deactivation if Account is owned by the user and send an Email with details. Trigger on user object: trigger userTrigger on ...
0
votes
1answer
26 views

Unable to use @future(callout=true) method in Apex class

1.Currently working on Apex with the flow to pass the API data. 2.If I use @future(callout=true) in apex it throws an error like below. Error: The only annotation that can be used with ...
1
vote
1answer
25 views

How to count email invocation in @future method ? Limit check after Test.stopTest is returning 0; [duplicate]

I can't understand why I am getting 0 from Limits.getEmailInvocations(); that is run after Test.stoptest(). The method which is sending emails is @future annotated and run from trigger handler on ...
2
votes
1answer
32 views

Max Number of callouts in future

Would like to clarify quick point as below statement in documentation is causing confusion. A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call. So suppose ...
0
votes
0answers
59 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: //...
-2
votes
2answers
62 views

Apex error : You have uncommitted work pending. Please commit or rollback before calling out [duplicate]

Apex error : You have uncommitted work pending. Please commit or rollback before calling out. I get the above error when I try to make two http callout one after the other and store the result in ...
0
votes
0answers
22 views

Invoking inter dependent callouts from a managed package

I have a requirement, where I have a scheduled apex which runs every 5 mins and invokes a future method of an apex class. This future method invokes a managed package method for making the callout. So ...
0
votes
1answer
44 views

Can @future be called in constructor of a class

Trailhead Link - https://trailhead.salesforce.com/content/learn/modules/asynchronous_apex/async_apex_future_methods#:~:text=Future%20methods%20won't%20necessarily,same%20order%20they%20are%20called.&...
0
votes
0answers
30 views

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record. Case not saving: [duplicate]

I'm getting this error when trying to save a Case: Failed to invoke future method 'static void cloneCaseWithCaseProds(String, String, Set<Id>)' on class 'CTRL_Support_ProcessV2' for job id '...
-1
votes
1answer
33 views

Unable to add the Remote URL https://th-superbadge-apex.herokuapp.com/equipment

Hi am attempting Challenge2 : Synchronize Salesforce data with an external system of the Apex Specialist Superbadge but unable to add the below url to Remote Site settings https://th-superbadge-apex....
0
votes
0answers
14 views

Creating QuoteDocument with Apex behaves strangely in one org

In my class I have a future call to create a QuoteDocument. This works fine in all orgs (sandboxes and production) I have access to. But in the target org, it only creates an empty PDF (in a partial ...
0
votes
2answers
68 views

Update a record in future method with JSON data [closed]

From process builder getting record id and pass that in to apex. Apex class to update the record: public class BacktoQuantum { @InvocableMethod(label='getdata' description='Get data ...
0
votes
2answers
94 views

How can I update a record with information obtained from a @future callout?

I have a trigger which executes a callout on the Case object to create a resource in my backend. The callout returns the ID of the created resource, which should then be added to the Case the trigger ...
0
votes
1answer
60 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 ...
0
votes
3answers
60 views

Multiple callout from future that is called from an InvocableMethod

I am having some difficulties to call multiple callouts from a future method which is calling from a Process Builder. I am getting the below error, System.CalloutException: You have uncommitted work ...
0
votes
0answers
62 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 ...
1
vote
0answers
28 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. ...
0
votes
2answers
75 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
78 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. ...
3
votes
3answers
353 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
38 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
129 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
49 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
33 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
78 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
121 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
29 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
30 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
434 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
55 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
59 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
442 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
269 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
308 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
634 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
233 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
26 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
179 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
44 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
88 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
50 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
59 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
117 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
342 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
202 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
269 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
1answer
609 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
261 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
322 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 ...

1
2 3 4 5
8