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
1answer
24 views

Question for confirmation: Callout from Trigger using Platform Events

After a record is updated in Salesforce, i need to perform a callout to synchronize data to an External System. Ideally, i would like to do this kind of synchronously, however it doesn't seem to be ...
1
vote
0answers
27 views

Guest User can perform update under future method

I have a site page with a form that can be accessed by guest users. I have an upload button that when it's clicked a tracking record is created (it's ok for guest user as the profile has read/create) ...
0
votes
0answers
19 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 ...
0
votes
0answers
20 views

Generating a CSV through a report inside an invocable method THROWS exception, but in a normal method it doesn't!

I am trying to generate a CSV through an InvocableMethod but it throws an exception. If the same code runs in a normal method, then no exception is thrown. In the following code for example sendEmail2 ...
1
vote
1answer
26 views

UNKNOWN_EXCEPTION, portal account owner must have a role: In Future Method

When a contact is created I am trying to create community portal user. So first I wrote the user creation code in trigger itself but I got the error 'MIXED_DML_OPERATION'. So I moved my user creation ...
0
votes
0answers
55 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 ...
2
votes
0answers
55 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 ...
1
vote
1answer
37 views

Why does Future and Queueable or any Async rollback or does not get called when an exception is occurred in Main Thread?

I was trying to test if Async opens up a new thread or is tied to the main thread and the result was very interesting. Consider this class: public with sharing class TestClassTest { public static ...
0
votes
1answer
45 views

Testing triggers with future methods

According to my functionality: insert and update calls a trigger that invokes future methods. In my test case, I need to test the update functionality. In order to test the update functionality, I ...
1
vote
1answer
31 views

How can we access visualforce page for pdf generation from a future annotated method

I have a future annotated method which should generate a pdf in PdfController, the method is as below: @future(callout=true) public static void savePdfAsAttachment(Id applicationId){ PageReference ...
0
votes
1answer
40 views

Salesforce Process Builder Apex Error: Too Many Future Calls

I've created an SalesForce Process that automates the creation of Asana projects for my org. This works well in small-scale, however when many data updates happen at once, we receive an error; Error ...
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
68 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
73 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
46 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
61 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
269 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
1answer
35 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
68 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
33 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
48 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
19 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
111 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
349 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
103 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
91 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
30 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
226 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
173 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
444 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
45 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
184 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
59 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
35 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
121 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
180 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
47 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
37 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 ...
2
votes
1answer
621 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
59 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 ...
3
votes
0answers
557 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
396 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
453 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
784 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
330 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
27 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
246 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
48 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
134 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 ...

1
2 3 4 5
9