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
1 answer
42 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 ...
user avatar
  • 11
-2 votes
1 answer
18 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(...
user avatar
0 votes
2 answers
25 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 ...
user avatar
  • 101
1 vote
1 answer
45 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(...
user avatar
1 vote
0 answers
62 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 ...
user avatar
  • 23
0 votes
4 answers
72 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 ...
user avatar
  • 11
1 vote
1 answer
84 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 ...
user avatar
  • 11
0 votes
2 answers
346 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....
user avatar
  • 101
1 vote
0 answers
68 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, ...
user avatar
-2 votes
1 answer
59 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 ...
user avatar
  • 750
1 vote
2 answers
68 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 ...
user avatar
3 votes
2 answers
267 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){...
user avatar
  • 3,167
1 vote
1 answer
562 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 ...
user avatar
  • 3,167
-1 votes
2 answers
145 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 ...
user avatar
  • 33
0 votes
1 answer
93 views

Salesforce @future not working [closed]

I am sending the request to the docusign in salesforce apex triggers. The apex triggers call the external class and then the method call the http request. If I use the @future on top of the method,...
user avatar
0 votes
1 answer
114 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 ...
user avatar
1 vote
0 answers
50 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) ...
user avatar
0 votes
0 answers
60 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 ...
user avatar
0 votes
0 answers
38 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 ...
user avatar
1 vote
1 answer
222 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 ...
user avatar
  • 59
0 votes
0 answers
71 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 ...
user avatar
2 votes
0 answers
58 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 ...
user avatar
1 vote
1 answer
191 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 ...
user avatar
0 votes
1 answer
104 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 ...
user avatar
1 vote
1 answer
43 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 ...
user avatar
  • 113
0 votes
1 answer
99 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 ...
user avatar
0 votes
0 answers
29 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 ...
user avatar
0 votes
1 answer
230 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 ...
user avatar
1 vote
1 answer
189 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 ...
user avatar
2 votes
1 answer
275 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 ...
user avatar
0 votes
0 answers
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: //...
user avatar
-2 votes
2 answers
1k 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 ...
user avatar
  • 11
0 votes
1 answer
57 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 ...
user avatar
  • 3
0 votes
1 answer
183 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.&...
user avatar
-1 votes
1 answer
72 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....
user avatar
0 votes
2 answers
241 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 ...
user avatar
0 votes
2 answers
889 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 ...
user avatar
0 votes
1 answer
215 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 ...
user avatar
  • 130
0 votes
3 answers
283 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 ...
user avatar
0 votes
0 answers
67 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 ...
user avatar
1 vote
0 answers
35 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. ...
user avatar
  • 125
1 vote
2 answers
592 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?
user avatar
  • 21
4 votes
3 answers
675 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'); // ...
user avatar
  • 143
-2 votes
1 answer
111 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){ ...
user avatar
1 vote
1 answer
306 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 ...
user avatar
  • 931
1 vote
1 answer
104 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"), ...
user avatar
  • 2,637
0 votes
1 answer
58 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 ...
user avatar
  • 1,387
0 votes
1 answer
317 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 ...
user avatar
  • 11
0 votes
0 answers
285 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 ...
user avatar
  • 3,720
1 vote
1 answer
241 views

Using @future in Before contexts

I'm 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 ...
user avatar

1
2 3 4 5
9