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

Batch class to upsert the record

Edited - I am upserting records with external id ssn so how should i put my ssn in failureIdsSet so that I can call the failureIdsSet in email alert. I have a batch class which I use to upsert records ...
user avatar
-2 votes
0 answers
11 views

How to write test class for this schedulable class? [duplicate]

global with sharing class pokeBatchList implements Schedulable{ global void execute (SchedulableContext SC) { List<Pokemon__c> pokeList = new List<Pokemon__c>(); for(Integer i=1; ...
user avatar
1 vote
2 answers
55 views

Method does not exist or incorrect signature: void schedule(String, String, BatchDeleteRecordChargeBack) from the type System

Can anything help me with this error. when my instance doesn't show the following error Method does not exist or incorrect signature: void schedule(String, String, BatchDeleteRecordChargeBack) from ...
user avatar
0 votes
1 answer
67 views

batch class to update the field after record insertion

I have one custom object(Import__c) where I am dumping all the records through data loader and runs a batch class to query the Import__c object and create respective records in another object (...
user avatar
0 votes
1 answer
30 views

What are cons of running a batch a few times a day?

Running a batch is needed because people want to see results from the batch in the same day. Now our batch runs every night Are there any issues (for example performance issues) of running a batch ...
user avatar
0 votes
1 answer
28 views

Batchable query

I would like to confirm my understanding to this batchable query. So, this query runs on case records that do not equal Status field from this query? Thanks. String query = 'SELECT Id, Status, ...
user avatar
  • 11
0 votes
1 answer
47 views

Schedule Batch Apex to run batch one after another in hours gap

I have a scenario where we are having a batch apex(batch size 1000) to be schedule to run daily which perform API callouts. I need to split batches to run after every one hour means one batch for an ...
user avatar
1 vote
1 answer
579 views

Resolution to this error: Attempt to de-reference a null object

I am new to Salesforce Apex coding and I am getting this null pointer exception error when i try to run a schedule batch. Please help me as i am unable to understand the mistake i made. The code is ...
user avatar
0 votes
1 answer
139 views

Apex code to get Tasks and send email to task owner

I want to send email to user about his open tasks. Each user will have more than one task. I have a set of taskIds and querying all tasks based on these IDs. How do I get email address of task owners ...
user avatar
  • 15
1 vote
0 answers
26 views

Issue with Batch Job completing abruptly

I am trying to process 1000+ records from Custom metadata(CMDT) via a batch job. This is how my business logic runs : In my start method, I query all the records from CMDT ,In my execute method I ...
user avatar
0 votes
1 answer
39 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 ...
user avatar
  • 61
0 votes
0 answers
39 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 = ...
user avatar
  • 771
0 votes
1 answer
36 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 = ...
user avatar
  • 771
1 vote
1 answer
62 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,...
user avatar
  • 1,183
0 votes
1 answer
41 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 ...
user avatar
  • 1,183
0 votes
0 answers
110 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 ...
user avatar
  • 1,183
0 votes
1 answer
47 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 ...
user avatar
  • 1,183
0 votes
0 answers
29 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 ...
user avatar
  • 1,183
1 vote
1 answer
208 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 ...
user avatar
1 vote
1 answer
70 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 ...
user avatar
1 vote
1 answer
240 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 { ...
user avatar
  • 31
0 votes
0 answers
40 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 ...
user avatar
0 votes
0 answers
24 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 ...
user avatar
0 votes
0 answers
35 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 ...
user avatar
1 vote
1 answer
93 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 ...
user avatar
2 votes
1 answer
1k 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.
user avatar
  • 150
0 votes
0 answers
42 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 ...
user avatar
-2 votes
1 answer
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 ...
user avatar
  • 1
0 votes
0 answers
68 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 ...
user avatar
-2 votes
2 answers
309 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 ...
user avatar
-3 votes
1 answer
184 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 ...
user avatar
-3 votes
1 answer
275 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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
0 votes
0 answers
39 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. ...
user avatar
0 votes
1 answer
36 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....
user avatar
0 votes
1 answer
561 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 ...
user avatar
0 votes
1 answer
642 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 ...
user avatar
  • 55
0 votes
1 answer
106 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 ...
user avatar
0 votes
2 answers
34 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 ...
user avatar
1 vote
1 answer
2k 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 ...
user avatar
1 vote
2 answers
320 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<...
user avatar
0 votes
1 answer
47 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 "...
user avatar
0 votes
1 answer
797 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). ...
user avatar
  • 1
4 votes
1 answer
402 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....
user avatar
  • 5,724
0 votes
1 answer
129 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> { ...
user avatar
1 vote
0 answers
359 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() ...
user avatar
0 votes
0 answers
82 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 ...
user avatar
  • 125
0 votes
1 answer
153 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....
user avatar
  • 165
0 votes
1 answer
58 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 ...
user avatar
  • 125
0 votes
1 answer
66 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 * * ?
user avatar
  • 1,298

1
2 3 4 5
10