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
votes
0answers
18 views

Send an email when a status has not been changed for few days

I need some help and suggestion regarding sending an email alert everyday when a status value is not changed for certain business days. Pending Approval - 5 Business days (on 6th day an email should ...
0
votes
1answer
35 views

Single record callout to run once in the near future

I am trying to find the best solution to my problem below and I'm feeling like my current solution can't be the easiest way to go about it. Let me know if I'm missing something or if this does sound ...
0
votes
0answers
30 views

Avoid Apex Schedule limit

We have a requirement to launch two schedule apex each hour but we're reaching schedule limits. I have this piece of code in apex: public void finish(Database.BatchableContext BC) { Datetime now = ...
0
votes
1answer
30 views

Schedule Apex not working properly

I have a batch that schedule a job for the next hour but in my Production environment is scheduling it for the following month. public void finish(Database.BatchableContext bc) { Datetime now = ...
1
vote
1answer
37 views

Batch Create Records - Creating Multiple Duplicates

I have a scheduled batch class that creates new custom object (Churn_Tracker__c) records for each Account on a monthly basis with 3 AggregateResult counts as part of each newly created record. However,...
0
votes
1answer
37 views

Batch Apex - Errors: Too many SOQL queries / Row with Duplicate ID

I am trying to create a batch class to create new custom object records related to each Account in the organization. The batch first needs to count all the Asset records for each account, where the ...
0
votes
0answers
53 views

Batch Apex Error - Row with duplicate Id

I have the below scheduled batch class to run every month. The purpose is count Asset records per Account and then create a custom object (Track__c) record for each associated account showing that ...
0
votes
1answer
25 views

Test Class for Scheduled Batch Class - Error

I have a scheduled batch class that will eventually run on the 1st of every month. It's designed to find records from an Asset that are linked to Accounts, aggregate the counts of these records into 3 ...
0
votes
0answers
24 views

Flow or Apex for Counting Child Records & Creating new Custom Record

I have a situation where I have a custom object (object A) with a master-detail relationship to the Account object. I also have another custom object (object B) that has a lookup relationship to the ...
1
vote
1answer
41 views

Bypass/deactivate validation rules, workflow rules, process builders in apex class

We are writing batch job to update a field one of object records through batch(around 500K records). I have validation rules, workflow rules, process builders on this object which increases the batch ...
1
vote
1answer
45 views

Scheduler is using previous version of Apex batch

[Step to Reproduce] Create a new Apex Batch. Set a Scheduler for the Apex Batch. Update the Apex Batch. => Once the scheduler runs, the scheduler still using previous versions of Apex Batch. The ...
1
vote
1answer
224 views

Can I define the order when using two batches in the Schedule Class?

public class ScheduleOnProjectSum implements Schedulable { public void execute(SchedulableContext SC) { DeletedSBLBatch dsb = new DeletedSBLBatch(); try { ...
0
votes
0answers
29 views

Scheduler is unstable, the behaviour is weird

[Background] I have 3 daily scheduler The scheduler is scheduled at 8am, 12pm, 6pm All of the scheduler run same Apex class The process of Apex class is selecting some records and copy over to ...
0
votes
0answers
20 views

How to create a new schedule with Batch with Contructor

Currently, I have in my org this code below, it runs several times a day it calls an API that tracks the shipment. The problem is that I need to create a new Schedule for a new type of shipment. The ...
0
votes
0answers
29 views

How to abort a scheduled job that is 'blocked'

We have an Apex class that automatically schedule a Job to be run 10 min after the request is done. In some cases, this job doesn't run at all and since we cannot schedule another job (business ...
1
vote
1answer
74 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
374 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
40 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
58 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
103 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
69 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
95 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
29 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
196 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
347 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
47 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
29 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
438 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
189 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
23 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
403 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
268 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
61 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
20 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
171 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
55 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
111 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
41 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
26 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
30 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
90 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
103 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 ...
1
vote
1answer
92 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
62 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
41 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
253 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
38 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
2 3 4 5
10