Questions tagged [asyncapexjob]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
17 views

how quable solves the problem of having soobjcets in future mthods?

As per my knowledge both future and quable are async methods ,we don't know when they run,that's y we cant pass sobjects as parametrs in fuute methods(i read in future trailhead) because objects state ...
0
votes
1answer
19 views

Async apex job aborted manually from Apex Jobs Monitor - any way to catch that from the batch class?

I've just learned that finish() is never called when a batch job is aborted manually by a user from the Apex Jobs monitor. However, I would like to be able to run some logic in a batch class when its ...
0
votes
0answers
17 views

ApexAsyncJob marked as 'Completed' but CompletedDate is null

I was left confused to see that the Status of an ApexAsyncJob could be 'Completed' but the CompletedDate was null. Shouldn't there be a value in the CompletedDate field if the job is complete? Why is ...
0
votes
1answer
40 views

How can I handle in Apex if a new Apex Job is enqueued

I would like to know if there is a way to handle the creation of a new Apex Job inserted the Flex Queue, since the object AsyncApexJob is not supported in Triggers. I was also considering handling an ...
-2
votes
2answers
35 views

what is the parameter database.batchablecontext?

I was learning batch apex and it has three method which is start,execute and finish. Each method has a parameter Database.BatchableContext. What is this parameter and why it is being used in all ...
1
vote
1answer
47 views

I am trying to Schedule Class that will add a new contact under Account every 2 min

I am trying to Schedule Class that will add a new contact under All Account every 2 min and also there should be a validation check that you can not have more than 05 Contacts under a single Account. ...
0
votes
1answer
165 views

How to call AsyncApexJob in test class from batch class finish method

here code is passed and code code coverage is not coverd, Please help me any one Test class test.startTest(); // UpdateOppToInitialize.UpdateOppToInitialize(); UpdateOppToInitialize obj = ...
1
vote
3answers
131 views

Why queuable apex accepts sobjects where as future methods doesn't?

I was going through asynchronous apex and reading it made me confused at one point. In future methods, we cannot pass sojects for reasons future methods being executed at a later point of time, by the ...
3
votes
0answers
69 views

AsyncApexJob: TotalJobItems != JobItemsProcessed + NumberOfErrors

I'm running into an odd issue where AsyncApexJobs (from Batch Apex) are finishing with a status of "Complete" but the TotalJobItems != JobItemsProcessed + NumberOfErrors. Should I be concerned that ...
0
votes
1answer
47 views

Find job status using the id returned from Database.executeBatch?

I have a class that is Database.Batchable which I execute via Database.executeBatch. How do I find the job status Id using the id returned from Database.executeBatch? It doesn't seem to match the Id I ...
0
votes
1answer
55 views

In Visualforce how to display progress and errors of Asynchronously upserting the results of 999 queries? [closed]

In Visualforce I need to ASYNChronously do 999 (n) multi-table queries and upsert all results (asynchronously, and presumably in chunks), to 1 custom_object__c, all from a visualforce page. The page ...
-3
votes
2answers
18 views

While trying to run ScheduleApex it give error

//This is code global class Schedule1 Implements Schedulable{ global void execute(SchedulableContext sc){ List<Account> accounts=[SELECT ID,NAME,INDUSTRY FROM ACCOUNT WHERE NAME='...
0
votes
0answers
46 views

How to get complete error message from AsyncApexJob records?

I have a batch class in my managed package. One of the batches is failing the execution in Subscriber org. When I query the AsyncApexJob record related to that batch class I get the incomplete error ...
0
votes
1answer
65 views

Scheduled Job occassionally does not reschedule for next run

I haver a scheduled job that runs every fifteen minutes. It runs fine for several months and then randomly it will stop running and doesn't reschedule for the next run. The apex jobs showed an "...
1
vote
1answer
94 views

AsyncApexJob record when I use System.scheduleBatch() method

I have just found a very strange behavior regarding Batch. If I have a Batch and run it using the method Database.executeBatch(), a new record inside AsyncApexJob table is created and I can use ...
0
votes
3answers
422 views

Is asynchronous apex either rolled back or not executed if the original transactions fails?

I would like to confirm the behaviour of asynchronous apex when an error occurs on its original/parent transaction. Imagine we have a synchronous apex transaction (Transaction1-Apex) that launches a ...
6
votes
1answer
139 views

ApexTestRunResult's status is set to complete and all tests pass, but the enqueued and completed count do not match

It is possible to programatically run tests in the platform by creating ApexTestQueueItem records. They reference classes by their Id, and you can even optionally specify if you want the test to ...
3
votes
2answers
2k views

What's the difference between AsyncApexJob and CronTrigger?

Roughly I know that when I schedule a Schedulable, I'm creating both a CronTrigger and an AsyncApexJob, but I'm confused as to how the two objects relate to each other and what the significance of ...
0
votes
3answers
441 views

Getting the job id of a chained job from the id of the parent job

I have a Queueable job that will initiate a Batch job. I have a transaction that enqueues the Queueable job and returns the id of the Queueable job. However, I need to be able to get the id of the ...
1
vote
1answer
552 views

How is calculated “24-hour period” for the limitation of Asynchronous Apex Executions

I have a question regarding Execution Governors and Limits for daily maximum number of asynchronous Apex method executions. In the Salesforce documantation it is written, that the maximum number of ...
3
votes
0answers
65 views

schedule jobs to be run in the past

I have a scheduled job whose "Next Scheduled Run" is set to a date in the past: Cron expression: 0 30 20 * * ? * Does it mean that this scheduled job will never run? What could be the reason for ...
0
votes
1answer
102 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
334 views

How to send an alert notification if Async Apex execution limit reached 70%of limit

I want to send an alert notification when overall organisation Async Apex Execution limit reached 70%of total limit. Say if limit is 2500 and if system already exhausted 1750 of daily Async Apex Limit ...
1
vote
0answers
185 views

How can I create a meaningful test of a function which creates a Queueable which posts Announcements through the ConnectApi?

I have this method: public Id doPostAlerts(List<Product2> productList){ List<ConnectApi.AnnouncementInput> announcementInputList = new List<ConnectApi.AnnouncementInput>(); ...
2
votes
1answer
20 views

How do I expose background tasks to end users?

My users sometimes kick off some long-running background processes (e.g., add 150 records that look like this template, run this batch process, etc.). Right now, if those processes fail, they are not ...
5
votes
1answer
929 views

Can't Save Class (batch or future jobs pending or in progress)

I have a problem saving one of my classes into server. The error that I get is: Error: Compile Error: This Apex class has batch or future jobs pending or in progress at line -1 column -1 I have ...
0
votes
0answers
17 views

What besides a batch process/future call can update an opportunity on a schedule?

We have this weird issue where certain opportunities are being updated around the same time each day, but I cannot figure out for the life of me how this is happening. There are no batch processes/...
4
votes
1answer
2k views

How can I tell batch job finished executing the finish() method?

In my controller I want to know when my batch job has fully finished running; not just the execute method but also the finish. I have tried the following and both seem to return true when execute has ...
2
votes
0answers
121 views

All attempts to execute message failed, message was put on dead message queue

I have a process that is chaining Queuables using a future method similar to this: public class MyQueuable implements Queueable{ public virtual void execute(QueueableContext context){ //do ...
20
votes
1answer
2k views

Dramatic increase in AsyncApexJob latency

Problem Salesforce is a multi-tenant platform and as a consequence the time for an asynchronous request to be dequeued may vary. This is not a problem for us, as long as the delays stay within ...
0
votes
1answer
72 views

VisualForce : Error CPU time limit exceeded in scheuled job

I have a scheduled job that sends page content via email, page controller needs about 15 sec to finish executing(looping over histories of more than one object) so sometimes scheduled job fails ...
0
votes
1answer
229 views

How to delete Batch Process Logs in Salesforce?

Was running some tests in my dev org and got this: System.DmlException: Insert failed. First exception on row 0; first error: STORAGE_LIMIT_EXCEEDED, storage limit exceeded: [] I know the issue ...
4
votes
1answer
1k views

Check if an SOQL query is valid without actually executing it

I'm building a system where a user will be providing me with a query through a UI. This query will then be used in an Async Apex Job, by passing it as a param to Database.getQueryLocator in the start ...
1
vote
1answer
347 views

Rollback all completed jobs in a chain

I'm writing an application where I'm chaining jobs by calling executeBatch for the next job in the finish method of the previous one. In case a job somewhere in the chain fails, I'd need to rollback ...
1
vote
1answer
141 views

Governor limits in dispatching BatchApex jobs - how much and where to find them?

As a follow up to this question, here are some questions I've not been able to find an answer for: How many batch jobs can you dispatch before you exceed governor limits? 100 or 105? Do scheduled ...
2
votes
2answers
3k views

Retrieve a list of currently running jobs

I'm building a system that will be calling executeBatch on quite a few batch apex jobs. I want to make sure that I haven't already hit the limit on the max number of jobs queued up. I believe ...
1
vote
1answer
478 views

Can a future method conflict with a queuable method?

My custom code is executed using a queuable class. Sometime it runs perfectly, other times it gives this error: Failed to update list. Error: System.DmlException: Update failed. First exception ...
7
votes
1answer
318 views

Is an AsyncApexJob record inserted immediately at the end of a transaction?

Is an AsyncApexJob record inserted immediately at the end of a transaction or is it possible that there is a delay between those two events? I couldn't find firm guarantee in the documentation on that....
4
votes
1answer
248 views

Are start() methods of batches guaranteed to run sequentially?

The question is very similiar to this one: Are batch jobs guaranteed to run sequentially? I basically want to ask the same thing, except this time for start() method. Do start() methods of ...
5
votes
1answer
201 views

AsyncApexJob table has additional record initially? platform bug?

I noticed when creating a new dev org, and running my first batch job. I then query the AsyncApexJob table and there are 2 records instead of the expected 1. There seems to be a default record in ...
0
votes
0answers
113 views

Callback on completion of AsyncApexJob

Is there a way to have Apex code execute when an asynchronous job finishes? I want to solve this problem without polling (which seems to be the dominant solution).
2
votes
0answers
119 views

When does System.abortJob() take effect with regards to a transaction?

If I call System.abortJob() in a transaction, when is the job actually aborted? Does it happen immediately, or only once the transaction is committed? I suspect the latter, as you don't want to have ...
1
vote
0answers
183 views

How to get the batch jobs result

I hava a simple requirement in my project,i need to pull data from outside service via calling restful api and push salesforce data to outside service with same way. so,the problem is the data is very ...
0
votes
2answers
80 views

Queuable interface calls many times

I'm calling a queuable interface via a trigger afterupdate. this queuable interface is allowing callouts to an external webservice ( Database.AllowsCallouts ). When I check the apex jobs, I found ...
8
votes
1answer
1k views

Can't I use ALL ROWS in asynchronous Salesforce queries?

I would like to perform asynchronous queries that could retrieve deleted rows as well. However, if I submit a batch with SOQL like select Id, IsDeleted, Name from Account where IsDeleted = true and ...
7
votes
2answers
767 views

System.LimitException: Too many async calls created: 2

I am trying to run two batches: 1.ContactNonEligibleMarker - Updates a status on the contact 2.RelationshipCreatorForContact - Creates child records(Relationship__c) under a contact. In the finish ...
2
votes
0answers
740 views

How to get the info on AsynCallouts made with Continuation framework(or Class)

I am using WSDL classes generated from the WSDL xml, to make the webservice callouts. I was making the callout synchronously, but later I want to change it to Asynchronous callouts. As we already know ...
2
votes
2answers
3k views

Why salesforce has introduced Queueable Apex. need some proper clarification

future method behaviour - 1. is executed in their own thread 2. do not start untill resource are available 3. future callout gives us 200 asynchronous soql limit. Why we use Queueable Apex and in ...
2
votes
0answers
1k views

Apex Batch job is failing with Internal Salesforce Error

I have a batch job that i'm executing from developer console Id batchJobId = Database.executeBatch(new TPI_BATCH_CHILD_ACCOUNT_PUSH(), 200); But i've checked from workbench with the batchjob id its ...
1
vote
0answers
214 views

purgeOldAsyncJobs(dt) does not delete old aborted ScheduledJobs

I have a process that create scheduledjobs every minute (someone else wrote it). It is scheduled every day at 8 then schedule itself until 20. I know Salesforce should delete jobs older than 7 days ...