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

Invalid Type and incorrect signature error in Future class

Hi we have a @future class created, however we have this error as per the screen shot below Please find the code below public with sharing class Addressfuture { public Addressfuture() { List&...
0
votes
1answer
101 views

How to know the completed time stamp of my scheduled Queueable class

I'm looking at What's the difference between AsyncApexJob and CronTrigger? Currently I have a Schedule class, and queueable class(which fires future methods). Below is the hierarchy: Schedule class ...
0
votes
1answer
151 views

What is the query limit for @future method

What is the query limit for @future method and can i use future method to fetch more than 50,000 records
0
votes
0answers
46 views

Did not receive exception email in production

We usually get exception emails to our admin from the production. I have a asynchronous code running in production @future public static void processRecords(String FIMCJSONRec) { ...
1
vote
1answer
535 views

show error message after delay in lightning

Here is the situation. I have a @Future method which has callouts is running along side of actual main CLASS. in the callout response, I am receiving some error/success XML, I am saving them in a ...
1
vote
2answers
1k views

a way to return value from @future method

I have a situation where I have to insert data into a wrapper class and a bunch of objects to save in Salesforce first and then make an API call. As we know, salesforce will not allow us to make any ...
0
votes
1answer
125 views

Get Set and Process in Loop

This line works: Set<Id> ids = (new Map<Id, Contact>([SELECT Id FROM Contact WHERE RecordType.DeveloperName = 'recordTypeName'])).keySet(); This line works: ws_contact.future_callout(...
2
votes
2answers
322 views

Queueable Apex consideratoins

This is more of a theoretical question and probably goes more to design and I hope I can do this justice. I have successfully coded in apex multiple triggers which make callouts using the @future (...
0
votes
1answer
54 views

Retrieve information from other Org using REST Callout

I am new in salesforce and i have a REST request callout to retrieve the information from the other ORG. My problem is, I don't know if my code is correct since there is no error but in my VFPage, ...
1
vote
1answer
397 views

HTTP POST Request with @future and schedulable

I need to create a schedulable Apex job which will send Sales Order Number from Case Object to my integration platform Web Service as JSON. This will be re-mapped and sent to another system, re-mapped ...
2
votes
0answers
814 views

Testing a queueable class containing a future callout [duplicate]

I have a queueable class that makes callouts (@future(callout=true)) in the execute method. When I manually test this, everything works correctly. But when I set up my test class, it gives me the "You ...
4
votes
2answers
540 views

Preventing Recursive Future Calls

I have a usecase where when an account is updated, an after update trigger is fired. This trigger will call a future method which will call a SOAP API to assign the relevant territory assignment rules....
0
votes
1answer
211 views

@future Attempt to de-reference null object

The business requirement is to have a lookup relation ship between a Contract and Opportunity. A field on the opportunity must get the SUM of a custom field on the Contracts which belong to the ...
0
votes
1answer
126 views

Future method throwing error

We have a future class which will call future class to send mail. Sometimes I get this mail from salesforce. Apex script unhandled exception by user/organization: 005A00000062Q6O/00DA0000000YXoL ...
1
vote
1answer
75 views

Future Class triggering two emails instead of one when a record is updated

I have delete this post as it has sensitive info.
1
vote
2answers
215 views

method @future two transactions

In an @future method can I persist a data at the beginning of the execution and the others at the end? Pratically, can i open and close two different transactions in the same @future method?
2
votes
2answers
486 views

future method concurrency

I have a button that calls a very complex feature that caused salesforce limits to be reached. I modified the method in asynchronous (@future) and added two states: "waiting" and "not processed". ...
1
vote
2answers
74 views

Future Method Invokation

I know we can't call future method from a batch class or from any future methods. "Future method cannot be called from a future or batch method" I have an Account trigger which has a lot of future ...
0
votes
1answer
470 views

Future method rollback

I have a System.LimitException problem: Apex CPU time limit exceeded in Apex, and I have therefore modified a synchronous functionality in asynchronous functionality by changing the method in @future. ...
1
vote
1answer
206 views

Error while opening PDF document created through Future method

I have a webservice class 'restExample' which first performs DML operations and then calls a future method 'createDocument()'. This method will create PDF document. One important point: Running user ...
0
votes
0answers
483 views

Insert New Picklist value with record type in MetaData Service [duplicate]

Using MetaData API, am able to insert the value in Picklist field in apex code but it is not available for any record type. I am finding hard to expose the value to record type. Here is my code, ...
1
vote
2answers
35 views

Why there is explicit provision for not allowing callout from future methods using (callout=false) , if by default it doesn't allow?

Like with 'without sharing' and 'with sharing' for class, 'without sharing' has clear use in case you want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it ...
10
votes
2answers
393 views

Guarantee only a single asynchronous job runs at a time

This is a bit of an odd one. We are interacting with an external system that does not support concurrency due to a bug which they are struggling to fix. We perform a HTTP callout, the callout takes ...
3
votes
2answers
1k views

Queueable - Callout not allowed from this future method

I am using a queueable class to handle various date ranges that are then sent to a web service. Upon calling the queueable class I am receiving the following error: Callout not allowed from this ...
6
votes
2answers
7k views

Callout Limits for future methods and queueable apex

I'm aware from the docs that "A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call." Is anyone aware if that limit is higher in a future methods or ...
3
votes
1answer
210 views

prevent trigger fire from a future method [duplicate]

I would like know if there is any global variable i can use to prevent trigger fire from a future method. Like I can use System.isBatch() to prevent trigger fire from batch classes
0
votes
1answer
581 views

Heap size limit error when making a callout to external endpoint

We are making a callout to external endpoint from Salesforce to get the attachments. when attachment size is more than 6 MB its throwing me Heap size limit error and we are running this callout from ...
1
vote
1answer
150 views

how to send trigger data to future method and change it based on response from callout

My triger code is trigger sendMessage on Message__c (before insert) { //retrieve contact info of selected contact-------------------- sObject contact = [Select Name, Phone, Title, ...
1
vote
1answer
312 views

Disable Future method from running twice

I have a future method that i call in afterInsert and AfterUpdate Triggers. i want to disable the running of the AfterUpdate call if AfterInsert ran before it, if i do not disable it i get the ...
0
votes
0answers
67 views

Mass Transfer Records: Too many future calls error

My production Org is presenting this error of too many future calls: 51 This error occurs when the user responsible for this task trys to use the Mass Transfer Records option for Accounts. Is there ...
1
vote
2answers
712 views

First error: Too many query rows: 50001

I have a read query in a batch class which in orgs with a lot of data can bring back over 50,000 records and violate the governor limit. I am trying to hard delete records. I am using the class below ...
1
vote
1answer
180 views

Can't Cover @future REST Callout

I have the following trigger and REST-callout class in a source org: trigger SendOpp_Trigger on Opportunity (before insert) { for(Opportunity o : Trigger.new){ SendOpportunity....
0
votes
1answer
396 views

Could anyone help me how to stop recursion of future method by process builder

public class LeadConvertClass { @future(Callout=true) public static void futureCallout(List<String> ledIds){ LeadStatus status= [Select Id, MasterLabel FROM LeadStatus WHERE IsConverted=...
0
votes
1answer
41 views

Testing future methods: data scope

I'm trying to test my @future method, in which I'm performing Custom Object update, but when I'm asserting values, updated object field equals null. Could it be a problem with method scope? I'm adding ...
0
votes
1answer
512 views

How to test partner user community

I have created a user without userrole in my testclass if I run this in my sandbox my testclass gives 100% coverage. When I try to deploy this to production it gives me 0% coverage as I figured out ...
0
votes
1answer
113 views

Test.stopTest() does not run @futureJob called from an enqueuedJob

I have a future job that is called from an enqueued job. The code works fine when I run manual tests; however, when my test class, which looks like the code below doesn't finish the future job: Test....
3
votes
1answer
8k views

Static method cannot be referenced from a non static context in testclass

I am working on a testclass but get the error that my method cant be referenced from a non static context. I have a class where I insert a list of contacts followed by a @future method. I get the ...
0
votes
1answer
912 views

Pass value from one method to another

How do I pass a value from one method to another. I am using a public list with a {get; set;} but this seems not to be working. What I want to achieve is to loop trough the insert from the first ...
0
votes
1answer
495 views

How do I advoid mixed dml operation creating user for community

I am trying to create a list of contacts and add these to the community as users. I keep getting the error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have ...
0
votes
0answers
51 views

used system.enquejob but still facing System.LimitException: Too many future calls: 51 [duplicate]

My trigger trigger triggSendRebateData on RebateData_for_MC__c (before insert,before update) { List<RebateData_for_MC__c> lstRebateData = new List<RebateData_for_MC__c>(); for(...
6
votes
4answers
1k views

Parallel callouts in apex

On some user action, I am calling several different third party services in order to update data in salesforce. As these callouts are time consuming, I would like to execute them in parallel, and when ...
1
vote
0answers
203 views

User Automation and Future Method and Permissions Issue

I am stumped on a problem and was hoping someone could spur some thought. I have two users who have different profiles. The System Admin profile is able to get through a Future Method and a ...
0
votes
1answer
1k views

Future Method and Static Variables

I have a class that implements Process.Plugin. It calls the invoke method, which calls a future method, which calls a webservice. The returned value from the webservice should be the output parameters....
3
votes
1answer
195 views

Future call from apex:component?

I have 2 Visualforce components inside a main page. Now the issue is that I need to call a @future method from one of them and I think this is not possible. Every time I get an error: System....
2
votes
2answers
1k views

How to get apex job id based on future call

Is it possible to get Apex Job Id in Apex job after executing the future call? Basically I want to get the job Id and its detail information to copy it to another custom object. So after the future ...
10
votes
2answers
977 views

Does queueing a future method count as DML?

We need to implement the following pattern at my org: callout to external data source if that callout takes too long (according to some configurable threshold), log an error (ie do some DML) if that ...
1
vote
0answers
3k views

Future Method cannot be called from batch [duplicate]

I have written a batch class which triggers in after update trigger on the object. This Afterupdate trigger in turn calls the future method. After running the batch class i realise that Salesforce ...
3
votes
1answer
1k views

@InvocableMethod/Process.PluginResult And @Future

Is it possible to set either the @InvocableMethod or Process.Plugin with a @future(callout=true)? My problem (bear with me): I have a trigger that calls a class the class creates an object and ...
4
votes
1answer
1k views

Future Method to Trigger to Future Method

I was attempting to call a future callout method from a trigger and am getting the error that a future method can not be called from a future or batch method. The trigger is being called on insert of ...
0
votes
1answer
451 views

How to query more than 50000 records in start method of batch apex?

Problem: I am using SOQL query to retrieve more than 50000 records inside start method and passing those records to query locator. I am getting this error :Too many query rows: 50001 in batch class. ...