Questions tagged [schedulebatch]

Class than can be scheduled to run at a certain time and invoke a batchable class

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

Using metadata in formula in Apex

I was working on a bank management App. and as a feature, I created a batch that is supposed to do a deposit regularly every three months. And the requirement was that I use a custom metadata for the ...
2
votes
1answer
154 views

How can I schedule a batch for every 2h (to run at half past?)

How can I schedule a batch every 2h (to run at half past?) like.. 00.30, 2.30, 4.30, 6.30, ..... 20.30 Thanks.
0
votes
0answers
36 views

Doesnt upsert all the records when I execute

I tried running a schedule job through anonymous window, it executed but ithasnt upserted all the records. There are 10,000 records and only 8000 were upserted. I see this in the logs - Exceeded ...
-2
votes
1answer
37 views

Variable does not exist: CurrentElement in batch class

I'm trying to insert data from standard FlowInterview object to Custom object. But it is throwing error like below for all fieds mapping. Below is my code public class FlowInterviewHandler implements ...
0
votes
0answers
50 views

Unknown salesforce error

I received the following error message when a batch apex job is being executed: Salesforce System Error: 2034297691-23646 (-1315618792) (-1315618792) I have also checked the logs and this is what ...
-2
votes
2answers
53 views

Getting 'First error: Attempt to de-reference a null object ' error on Batch class execution

My batch is running without any error in lower environment, but when I scheduled batch apex in Production, it shows this error :First error: Attempt to de-reference a null object. I have tried to use ...
-3
votes
1answer
39 views

APEX JOB TO DELETE RECORDS

I have a demand and I need help to create an apex that is in Batch and delete all accounts with more than 10 years on the platform. I managed to get to the code below but I can't advance can someone ...
-3
votes
1answer
43 views

Need help with the Test Class for following Case Object Batch Class

I am new to Salesforce coding and trying to write my first test class. I have tried all day but can not get any coverage for this batch class. Can anyone please help me with the test class for this ...
0
votes
0answers
29 views

How to write a test class for this Batch covering all scenarios [duplicate]

I am writing a test class for following batch, but code coverage is not increasing more than 28%. Can anyone please help with the test class for this batch. global class CaseOwnerManagerUpdate ...
0
votes
0answers
25 views

How to catch exception if flexQueue is full when using System.scheduleBatch

What happens to a batch class which is scheduled to be executed by System.scheduleBatch(batchableClass, batchClassName, 1, 50); The batch class gets scheduled as a Schedulable Job after a minute. ...
0
votes
1answer
33 views

Not getting enough test coverage for schedulable batchable class

I'm updating some code written by another developer, and I'm having a problem getting adequate code coverage for the batchable, schedulable class. None of the test methods call execute(Database....
0
votes
1answer
93 views

Is it possible to schedule a class every 14 days?

I am trying to schedule a class every 14 days based on a start date. Example: I want the scheduled job to run on 1st Tuesday of the month and 14 days off that i.e. 3rd Tuesday and then a 5th Tuesday ...
0
votes
1answer
155 views

Multiple Emails via Apex Batch instead of one

We have a Batch Apex that loops over 9 Custom objects and sends out one email to each user who are assigned in any one of the custom object. This should send out one email to each even though if they ...
0
votes
1answer
40 views

Insert record in related child object only if size of related object is 0

I am trying to insert record in related child object but only if size of related object (Comment__c) is 0. Means there should be no records in relate child object. I have done the implementation but ...
0
votes
2answers
28 views

How to control the number of records per run [closed]

I would like to know the best way for me to insert X amounts of records at a time. For example: Suppose I want to enter a list of 50000 records. In order not to run into problems, I thought of ...
1
vote
1answer
138 views

How to Send email to multiple user from batch apex

I am trying to create a batch that will run every day and will find the contacts which match the criteria. at the moment the code I have written is sending email to the same email address (time the ...
1
vote
2answers
144 views

Order of constructor execution for a class that implements a batchable as well as scheduleable interface

I am writing a batch class which should be scheduled to run at a certain frequency. I am putting both interfaces on same class - global with sharing class testbatch implements Database.Batchable<...
0
votes
1answer
19 views

Suppose I schedule a Schedulable batch job and my profile is "API User" and then it upserts

Suppose I schedule a Schedulable batch job and my profile is "API User" and then it upserts and a trigger runs to insert/update records. In whose context it will run? Who will show as "...
0
votes
1answer
210 views

Schedule triggered flow not running for all Resources

I have a schedule triggered flow that runs weekly on the Resource object. I have a custom setting checkbox which I use to denote whether the flow should run that week or not(bi-weekly pay schedule). ...
4
votes
1answer
235 views

executeBatch method returning invalid id 000000000000000

One of our client is seeing this issue in their production org. Following is the line where this issue is occuring : ID batchId = Database.executeBatch(MainBatch); This line is throwing System....
0
votes
1answer
50 views

Catch error in scheduled batch

I want to catch here an error on deleting records. but i dont really understand how? Can u help me please? public with sharing class AccountTest implements Database.Batchable<SObject> { ...
0
votes
0answers
16 views

Authsession values not coming in scheduled batch job

List<AuthSession> lstAuthSession = new List<AuthSession>(); lstAuthSession = [SELECT Id, SessionType, UsersId, UserType, NumSecondsValid, IsCurrent, ParentId, LastModifiedDate FROM ...
1
vote
0answers
83 views

Insert Big Object in Batch Class

I am trying to create records in a Big Object using a Batch class. However, when executing the Database.InsertImmediate() command, the error below occurs: Just as a note, the Database.InsertAsync() ...
0
votes
0answers
40 views

Execute batch from trigger if number of records in Trigger exceeds 10000?

Since we can't update more than 10,000 records in trigger in real time I was thinking of automating the update of the remaining records through a batch called from a trigger. So, Let's say for ...
0
votes
1answer
90 views

Is there ANY WAY to SCHEDULE this CODE?

private static void scheduleTEst(Set<Id> sObjectId, String cronJobDetailName, String className, Integer hour) { List<CronTrigger> scheduledExecs = [SELECT Id, CronJobDetail....
0
votes
1answer
33 views

4 Schedule Statements using scheduler vs scheduling a batch from finish method for every 15 mins

I want to schedule a job every 15 mins, for now I have created a scheduler class and using 4 statements to schedule it, but then again there is no guarantee that a job might complete itself in 15 mins ...
0
votes
1answer
23 views

schedule job using cron expression

How we can execute/schedule job every month's first week of saturday using cron expression. 0 0 13 * * ?
0
votes
1answer
23 views

A callout in the for loop of a batch class's execute method is causing: You have uncommitted work pending

I have a scheduled batch, that takes all cases with field isFailed__c true in the start method: global class UpdateCases implements Database.Batchable<sObject>, Schedulable, Database....
0
votes
2answers
50 views

Hourly Batch job not running as expected

We want to run a Batch job that runs hourly and updates the users to Inactive if they are logged in last 2 Hours but not 30 Minutes. The Code works fine when I run it manually and but i need to run ...
1
vote
1answer
80 views

System.SObjectException: ORA-20001 when deploying Changeset for users

I'm deploying an apex class and Test class which is running successfully and covering 84% test coverage in sandbox however when deploying it in Prod, I'm running in to below issue. I have included ...
0
votes
1answer
70 views

System.SerializationException: Unable to load class:

I have a scheduled class for which I'm getting this error. Apex script unhandled exception by user/organization: 0052i000001fdsd/00D2i0000003dds Source organization: 00D46000000ttrg (null) Scheduled ...
0
votes
1answer
29 views

SOQL to Pull LastLoginDate from past 2 hours but not last 30 minutes

Here is the scenario that I'm running in to. I need to able to pull users that logged in past 2 hours but not last 30 Minutes. I tried every possible way to filter this in but since we can't Use ...
0
votes
1answer
35 views

Running in to error First error: line 1:74 no viable alternative at character '"'

I'm trying to run a batch that makes user Inactive if logged in past 2 hours. It runs in to error ": line 1:74 no viable alternative at character" when i try to run this batch. I doubt if ...
0
votes
1answer
189 views

How to query records processed between last batch job if I'm running batch class five times a day

I want to process only those records in my batch job which are updated since the last time my batch job ran. Basically, I'm running my batch job five times a day and want to process only those records ...
0
votes
0answers
37 views

Query in Batchable class not working

So We have a Batchable class that calls another apex class which used to send the renewal link for all the contracts of a particular account type. It was working perfectly fine but now we are seeing ...
1
vote
1answer
21 views

Log indicates I am going over Query row limit but only pulling 153

I was hoping someone could give me some insight on why this is failing. I think it's because the Master Inventory Object is over 300 thousand records but the thing is I'm never querying even close to ...
0
votes
0answers
51 views

Delete a schedule Job that execute a batch job after the batch is finish

We want to execute a schedule job after a change occurs in one of ours custom objects. The Idea is to execute a batch after 10 min with all the changes that occurred on that time period. For that we ...
0
votes
2answers
49 views

Next Scheduled Run empty when using System.scheduleBatch in managed package

I'm trying to debug this recent issue. Code works fine in scratch orgs, but when ran in managed package scheduleBatch seems to never execute. I wonder if there's some throttling going on as we use ...
-1
votes
1answer
64 views

Dynamic Variable Scheduler Class

I'm looking to pass a variable to my scheulder class when scheduling a batch job. The idea is that I'm scheduling the class multiple times, but passing in a different variable each time. Example: ...
0
votes
1answer
36 views

Batch Apex Error - Class must implement the following methods System.ScheduleableContext)

I am trying to update a batch class to allow me to schedule it, but I am getting this error: Class must implement the following methods System.ScheduleableContext I understand the error, but given my ...
0
votes
0answers
303 views

Getting error in scheduled flow

Hi I have created a scheduled flow which will be fired before 30 days of expiration date on lead. But I am getting following error. SObjectRowId ={!$Flow.CurrentRecord} (null) Info Error Occurred: ...
1
vote
1answer
51 views

Do I have to implement the schedulable interface even if I only need it to run once and schedule a daily job?

I feel like i'm missing something basic here, I wrote a batch class that should be scheduled to run daily at a certain time of the day, forever. Do I really have to create an additional class that ...
0
votes
1answer
34 views

Scheduled end date in a custom report

I have custom report for scheduled batches i need fields included in the report Start date and END DATE of the scheduled jobs. I have checked these objects AsyncApexJob,CronTrigger,CronJobDetail but ...
0
votes
1answer
30 views

will the schedulable apex exceed if I run several call out functions in it?

for example, a schedulable that run two call-out functions like: global class scheduletest implements Schedulable { global void execute(SchedulableContext sc) { callOutFunction(a); ...
0
votes
1answer
47 views

Is it possible schedule an apex job to run several times everyday but during an interval time? [closed]

I am quite confused about the CRON expressions. I would like to run a job several times every day but in a time interval. For example: Every day run X job every 2 minutes from 3:00 am to 4:00 am. If ...
0
votes
0answers
25 views

Future method cannot be called from a future or batch method on Scheduled job

I have found this issue when trying to do a callout from an scheduled job and I can't get it to work properly. Schedule class: global class TM_LATAMCargaModeladoSchedulable implements Schedulable { ...
1
vote
1answer
54 views

Test Class Id Error

I trying to get better and have built a trigger/test class using my knowledge I have learned however I am running into an error with the test class that for some reason I just cannot resolve and ...
0
votes
1answer
78 views

Encountering Constructor not defined in test class

I'm scheduling a batchable class that deletes records from a custom object. The test class for my scheduled class saves without errors. However, I'm getting a "Constructor not defined: [...
0
votes
0answers
28 views

Schdeuled Batch Job Duration

I had 2 different scheduled batch classes that ran on 2 different custom objects, but both were designed to update their respective related Account records. I was running into an error that one of ...
1
vote
1answer
249 views

Testclass Schedule Batch Error - No more than one executeBatch can be called from within a test method. Unable to cover

I have Schedulable, Batch class public class Schedule_Batch_CheckUser implements Schedulable ,database.Batchable<sObject>,Database.AllowsCallouts, Database.Stateful{ public void execute(...

1
2 3 4 5
9