Questions tagged [schedulebatch]
Class than can be scheduled to run at a certain time and invoke a batchable class
480
questions
-1
votes
0
answers
20
views
REST Api integration between two orgs
Hello I want to connect 2 different production orgs for transferring data and being able to see report in one org. After exploring various options, we thought of building REST API as other options ...
0
votes
0
answers
23
views
Apex CPU limit exceeded on Batch start method
I have an scheduled batch that processes records but I'm hitting CPU limit exceeded error on start method.
This is my code (SortLogicBatchQuery retrieves ~500000 records):
public BatchSortProjects(){
...
-1
votes
0
answers
20
views
Can someone help in creating test class for this apex batch code? [duplicate]
global with sharing class DC_DripBulkAndJeopardyBatch implements Database.Batchable<sObject>, Database.Stateful,Schedulable{
//Static Status that is considered in Jeopardy and Drip Bulk.
...
-1
votes
1
answer
81
views
How to delete records and related records dynamically from SObjects
My Production org is almost full I need to delete Objects data and their related objects data based on SObjects mentioned in custom metadatatype.
I have written code to delete SObjects and related ...
-1
votes
1
answer
50
views
Batch Apex to add 10 Days to Closed date and then Automatically Change the Stage Name to CLOSED WON/LOST after 10 days
public class oppstage implements Database.Batchable<sObject> {
public Database.QueryLocator start (Database.BatchableContext bc){
return database.getQueryLocator('SELECT Id FROM ...
0
votes
0
answers
83
views
How to find out if a schedule triggered flow is running as a batch from the xml metadata?
This is the xml of schedule triggered flow. How to know if it is changing a batch of records?
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce....
0
votes
0
answers
50
views
schedulable class shows 0% coverage while trying to deploy to Production
I have a Schedulable class which calls a Batch class, I have enough coverage when checking in sandbox, But when trying to deploy to production Scheduler class shows 0% and Batch class shows 60%. I am ...
0
votes
1
answer
134
views
Org Migration - Behaviour of batch jobs during downtime
Our org is slated to move from AP13 to AUS64 next week.
The expected downtime is from 2 AM - 6 AM AEST (Sydney).
Fortunately we do not have much user activity during this window but we have batch jobs ...
0
votes
1
answer
101
views
Help-Logic to check if the submitted date/time is after 2PM and skip the update of that record- Batch class
This is the sample batch class that I am working on. This class is working fine but I need to add one more condition like, If status is set to submitted after 2PM, The number field should not be ...
-1
votes
1
answer
197
views
Help with "FIELD_CUSTOM_VALIDATION_EXCEPTION" Batch class failed to update records
I have a similar batch class and the problem is not with the logic.
public class SimpleBatch implements Database.Batchable{
public Database.QueryLocator start(Database.BatchableContext BC){
return ...
0
votes
1
answer
49
views
CPU--Limit Exception
I have written a batch which is giving APEX CPU LIMIT Exception,
can anyone help.
global class BatchTest implements Database.Batchable<sobject> {
list<Account> AccountstoUpdate= new list&...
0
votes
1
answer
58
views
How to schedule a batch class every third Sunday of a month at 12:00 lunchtime Central US Time zone
How to schedule a batch class every third Sunday of a month at 12:00 lunchtime - Central US Time zone - in an anonymous window?
System.schedule('Batchex', '0 24 19 ? * *' , new Batchex());
I used the ...
0
votes
1
answer
65
views
Test Class Showing in Code Coverage Window as Available for Coverage
a strange situation I can't find an example of elsewhere. I have a test class for a batchable apex that is showing in the developer console window as available for code coverage. Haven't seen a test ...
0
votes
1
answer
64
views
In the final method of batch class sending callout fails with SOQL Limit
I have a schedulable batch class which is stateful. In execute am inserting upto 1000 records.
In final method i have a list of ids of inserted record
global void finish(Database.BatchableContext BC)
...
-1
votes
1
answer
68
views
Scheduled Apex in waiting for more than a week
I have a couple of scheduled apex jobs which were all running smoothly. But since the beginning of this year pretty much all of them are having CronTrigger state as waiting. Some of them for more than ...
0
votes
1
answer
77
views
Calling one batch class from other batch class but batch size of both batch class is different [closed]
I wanted to know whether this is possible.
I have one after insert trigger and 2 batch classes.
I want to call the 1st batch class from my trigger by giving batch size as 200 and I want to call my 2nd ...
0
votes
0
answers
33
views
InstallHandler Scheduled Apex not Running
I have an installHandler running post install to create a scheduled Apex job that runs a batch Apex operation to an AWS S3 bucket. I am able to run the batch operation and run the scheduler using the ...
0
votes
0
answers
54
views
1. could we add a formula field in omni channel 2. could we add a custom field which is a datetime field in omnichannel
There is a requirement in an omni-channel queue. There is a field on Case object which is priority whose default value is set to 'medium'. Cases comes in omni-channel.
We need to change the value of ...
0
votes
0
answers
237
views
batch apex job enqueue failed
We are having a scheduled class that scheduled a batch job every 5 min. It works fine. But some time it failed to scheduled the batch job with the below error.
Scheduler: failed to execute scheduled ...
-1
votes
1
answer
318
views
How to delay specific batch job execution
I have a scheduler class (Schedulebatchjob) that collects list of objects and calls batch job (BatchJob) for each object. I would like to delay the batch job execution if the object name is User. ...
0
votes
1
answer
357
views
How to schedule a job twice a day with different minutes?
I have a batch that does three callout and then update some records, if occurs any error in the update or in the callout, a new record in the log object with the IDs of the records that occurred error ...
0
votes
1
answer
157
views
How can I get the contacts for which the email has been successfully sent in batch?
Below is my batch which sends emails to contacts based on the accounts passed in the scope. I want to mark the date on the Account on which the email has been sent to its contacts. Is there any way I ...
0
votes
0
answers
391
views
Scheduled Apex Batch job taking too long to execute
I have one batch job which delete old account associations then create new account associations & update fields[ For which logic is written in a trigger]
Previously it was taking less time, it ...
0
votes
1
answer
55
views
Merging two accounts if they have the same website,EIn and phone number
I am working on a batch class to merge two accounts if they have the same website,EIn and phone number.
I did a code and tested with accounts having same EIN same phone number and same website and it ...
0
votes
1
answer
251
views
Do schedule Apex stop running if there is an exception?
Do Schedule Apex execute method stop running if there is an exception (normal exception) ?
Do Schedule Apex execute method stop running if there is an exception (exception has occurred in a batch ...
1
vote
1
answer
897
views
AsyncApexJob returning two records for one executed instance of batch
When I am executing one batch then that batch runs only once. I have verified it from the 'Apex Jobs' from Setup. But when I am querying the AsyncApexJob for that batch class, it is returning two ...
1
vote
0
answers
55
views
How to add Isactive true in fflib for Account share selector class
I need to retrieve the user or group where Isactive =true, I have added as in the code but getting error
First error: Invalid field 'IsActive' for object 'Group'
public List<AccountShare> ...
0
votes
0
answers
14
views
How to write test class for batch in salesforce [duplicate]
I have a Batch like this, how to write test class coverage 100% for it. Please help me, thanks
public class StoreWorkTimeBatch2 implements Database.Batchable{
public Database.QueryLocator start(...
0
votes
1
answer
2k
views
I want make test class for batch apex
I want create test class for this batch class and when i execute with this code i got constructor() error.
BatchMessageType myClass = new BatchMessageType();
Id newId = Database.executeBatch(myClass);...
0
votes
1
answer
470
views
how to pass the value in test class [closed]
batch class
public class BillingSchemeRenewalWithoutAABatch implements Database.Batchable<SObject>,Database.AllowsCallouts, Database.Stateful {
public List<Billing_Scheme__c> ...
2
votes
1
answer
498
views
When I will change a class on Production (via change set deployment), then I need to delete and add "Scheduled Job"?
I changed a class via change sets deplyment.
Do I need to remove "Scheduled Job" with that class and add it again?
1
vote
2
answers
943
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 ...
0
votes
1
answer
374
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 ...
0
votes
1
answer
42
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, ...
0
votes
1
answer
915
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 ...
1
vote
1
answer
8k
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 ...
0
votes
1
answer
1k
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 ...
1
vote
0
answers
30
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 ...
0
votes
1
answer
42
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
0
answers
80
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
1
answer
72
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
1
answer
254
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
1
answer
98
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
0
answers
207
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
1
answer
166
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 ...
1
vote
1
answer
957
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
1
answer
432
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
1
answer
409
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
1
answer
68
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
1
answer
213
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 ...