Questions tagged [scheduled-apex]

Issues with writing, running, or testing scheduled Apex code, using the Schedulable interface.

Filter by
Sorted by
Tagged with
-1 votes
2 answers
40 views

Can we add the debug statement without a method?

I am new to programming world and i have this Doubt public class new { integer h=10; system.debug(h); } this code is not working untill i create a Method and add this debug statement!!! is it ...
0 votes
1 answer
30 views

Initially My Scheduler class was failing and when I add if(!Test.isRunningTest()) then its passing but its code coverage got dropped to 75%

here is the Apex class: global class GroupBatchSchedule implements Schedulable { global void execute(SchedulableContext sc) { GroupBatch b = new GroupBatch(); if(!Test....
's user avatar
0 votes
1 answer
25 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
37 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);...
1 vote
0 answers
76 views

Governor Limits: Scheduled Flows vs Async Apex

tl;dr - Do schedule flows (flow builder, not process builder) count against the same limit of scheduleable jobs that asynch apex (Queueable, Scheduleable, Batch) is limited by? If not, in what way to ...
  • 640
0 votes
0 answers
28 views

How to pass parametrs to scheduled apex class?

I have a method where I need to schedule an apex class that will close several Cases in 5 days but I need to somehow pass Case Id so the scheduled class knows which cases to remove after 5 days. How ...
  • 1
1 vote
1 answer
53 views

How to differentiate the batch class based on the different parameters passed and fire different email based on the parameters when batch class fails

I have a batch class which performs certain DML operation in execute method based on certain conditions. Also performing an update under finish method. I have a constructor where parameters of type ...
0 votes
0 answers
28 views

test class is not running execute method

thsi is batch class: global class Batch_ValueEdge_NotifyAID implements Database.Batchable<SObject>, Database.Stateful { public Integer currentYear = System.Today().year(); global ...
0 votes
0 answers
36 views

Do I use a flow or apex for time-based update? One flow or several for different conditions?

I have an object for which there is already an Apex triggerhandler that deals with multiple conditions for 5 different recordtypes. This is working fine. There are also currently 2 Process Builders ...
  • 1,409
-1 votes
1 answer
28 views

How can I send an email with a salesforce report attached?

I'm try to scheduler email send with a repor attached, but when i received the email, appear the next error in the file: I'm use the nex Apex code: global class Exporter implements System.Schedulable ...
0 votes
0 answers
169 views

Omni-channel: Automated Presence Status change

I've got a requirement which says that an Agent assigned to a Lead must have Presence Status set to 'busy' automatically when the right time comes: 10 minutes before the Date/Time field value in the ...
  • 1
0 votes
0 answers
17 views

System.InvalidParameterValueException: minutesFromNow must not be null in Schedulable Batch Test Class

Getting following error when i run the test class for schedulable batch System.InvalidParameterValueException: minutesFromNow must not be null @isTest public static void autoSchedulableBatch(){ ...
0 votes
1 answer
54 views

Schedule Apex Class and "Apex CPU time limit exceeded" [duplicate]

This is the first scheduled apex class I've ever attempted, and I keep running into the "Apex CPU time limit exceeded" error. Once a month, I'd like for the system to look for past due ...
  • 47
0 votes
1 answer
61 views

How to test schedulable class with future callout method

I'm trying to run this test and it keeps failing. The error I'm getting is "System.QueryException: unexpected token: 'null'" so it's related to my lstContacts SOQL query, but I can't figure ...
  • 17
2 votes
1 answer
135 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?
  • 35
0 votes
0 answers
37 views

Apex:Repeat - List of values are not displaying while the VF email is triggered

I have a requirement on email template that need to be triggered when a document is uploaded in a custom portal which was linked with development sandbox by "Account Document Manager" Object....
0 votes
1 answer
58 views

How can we get the Scheduled Job's Apex class and cron expression by scheduled Job Name?

Example: old developer scheduled an apex class by cron expression.But the scheduled job name is not given properly. Then how can we know that apex class by job name to verify what is that job doing? ...
0 votes
0 answers
20 views

My scheduled job randomly stops working

I checked debug logs and didnt find any issues but when i went to apex job i found that errormessage 'Java Heap Space'. How to fix that and what can be the problem. Job junner like over a year without ...
0 votes
1 answer
53 views

Test class for schedulable apex sending email with list of opportunities

Hi please help me write a test class for a schedulable apex class that sends an email to all users who have a checkbox on their user checked. //Send email to users where receive Grants email = TRUE ...
  • 21
1 vote
2 answers
306 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
0 answers
28 views

Summer 22 Schedulable Test System.CalloutException

I don't quite know how to explain the behavior we're seeing. I have two test methods that test exactly the same thing (same inputs, same assertions). The only difference is that one schedules the job, ...
  • 1,057
1 vote
0 answers
36 views

How to find out if a schedulable class was ever executed or is scheduled to be at all?

I am considering removing a field, which is no more needed, but I found it is used in a class, that I am not familiar with. It is a schedulable one and I first looked at the scheduled jobs in Setup, ...
1 vote
1 answer
82 views

Schedulable Class - Big Object

I've created a schedulable class that retrieves info from SetupAuditTrail everyday and creates a big object records on a daily basis. The schedulable class works fine. But when I run the test class, ...
  • 45
-1 votes
1 answer
41 views

Can I schedule a one time job or does it have to be recurring?

Is there always a need to do the kill cron job after scheduling it? Instead can I just schedule a one time job? If so, what is the difference in syntax between a recurring job and a one time job?
0 votes
1 answer
54 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 ...
-1 votes
1 answer
157 views

Getting error while scheduling apex class : "You must select an apex class that has a parameterless constructor"

I have an apex class that was scheduled and working fine. Due to inactive user the scheduled job has stopped working and now I am trying to create a new schedule for the apex class but getting below ...
0 votes
0 answers
26 views

Is it possible to set up a scheduled job to automatically move reports from one folder to another folder?

Since the Unfiled Public reports folder cannot be restricted, I was wondering if there is any way a job can be scheduled to automatically move any new reports created in the "Unfiled Public ...
0 votes
0 answers
38 views

Please I need help writing a test class for this scheduled class [duplicate]

public with sharing class Repeating_Scheduler implements Schedulable{ private final String JOB_NAME = 'PriceBookEntryHandler Job'; private final Integer ONE_MINUTE = 1; private void ...
-1 votes
1 answer
126 views

How to run a apex job and Scheduled apex

I have written a scheduled apex class and apex job that I want confirm if it works. How can I test/verify it will work as expected without waiting for it to run at its scheduled time for one record ...
  • 5
11 votes
2 answers
381 views

Poll for long-running API responses - Solution patterns

Many REST APIs that people want to use from within Salesforce have asynchronous, long-running operation. For example An endpoint POST /api/resource to create a resource returning a handle Id to check ...
0 votes
0 answers
97 views

how to cover catch in test class for a scheduler class

This is my scheduler class. I am not able to cover System.abortJob(ctx.getTriggerId()) My batch is updating values on the account object global class Tets_outage_batchScheduler implements Schedulable{...
0 votes
1 answer
401 views

how apply the cron expression in schedule class

I have the contact object in that i have one custom field like next_birthday__c and email field so i want send the email to the perticular user for birthday wish as the they filling the data my code ...
0 votes
1 answer
166 views

How to delete a child and a parent object in the same batch class?

I have a situation, where I need to delete both parent and child log files. I need a batch file, as the number of records is large, and the delete is on a weekly basis. OFC - I can write a second apex ...
  • 5,467
0 votes
1 answer
80 views

Running Utilization Job multiple times a day

I am trying to schedule a job to run several times a day. It's a Utilization job which is part of the FinancialForce PSA application. The UtilizationScheduler class has this signature: global class ...
  • 131
0 votes
1 answer
77 views

transient List of Database.Error becomes null in finish

I have a list to to accumulate All dB Errors, I need to use that list in finish. But the transient variable is null in finish. Here is My class: global class BatchToDoSomething implements Database....
0 votes
2 answers
718 views

Cron expression to run Job every second Friday

I need to schedule my class to run every two weeks on Friday. I see this in questions. However It is not excactly what I want. And I can not came up with an idea hot to write a cron expression for ...
0 votes
1 answer
660 views

Calling Flows from Batch Apex and making the Flow.Interview Class Bulkified

I am running a scheduled batch job daily on 25,000 records and growing. I Want to be able to leverage Salesforce Flow for processing the data because it gives more control to the Admin for ...
0 votes
0 answers
47 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 = ...
  • 791
0 votes
1 answer
44 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 = ...
  • 791
0 votes
0 answers
319 views

Scheduler: failed to execute scheduled job: AsyncApexJobObject, reason: You have exceeded the maximum number (100) of Apex scheduled jobs

I have implemented is a Schedulable Interfaced class, which I have scheduled to run every day at a certain time. In a nutshell, it runs a for-loop inside which, I use: system.scheduleBatch method to ...
1 vote
1 answer
109 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 ...
0 votes
1 answer
338 views

Update Lookup field based on a matching value in another field

Very new to apex and hoping someone can guide me on the best way to approach this problem Object: ObjA__c - Field: LookupToObjB__c (lookup) (field to update) - Field: JobNumber__c (string) Object: ...
  • 3
1 vote
1 answer
261 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 { ...
  • 31
0 votes
2 answers
545 views

Sending Email Reminders on Monthly and quaterly basis

I have a requirement where I have to send out email reminders on quarterly basic i.e.. twice. Once mid first month of quarter and on the end of 2nd month of quarter based on a condition (condition on ...
0 votes
1 answer
217 views

Scheduling Scheduled Job from Managed Package

I want user of the managed package to be able to run a scheduled job that repeats every hour. The Scheduled Batch class is from the managed package and I'm having trouble accessing it when logged in ...
  • 11
2 votes
1 answer
2k 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.
  • 150
1 vote
1 answer
130 views

Your organization has reached its hourly limit for processing workflow time triggers

There are a lot of similar question, but I'm trying to research why I get this message. I was looking into scheduled jobs and time based workflow. I am aware of the limits. Since I didn't find ...
  • 19
-2 votes
2 answers
445 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
1 answer
270 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 ...
0 votes
1 answer
150 views

Test two different scheduled apex classes from one test class

I have two different scheduled classes that I am trying to schedule from a single test class. A simplification is the first class creates a set of records, and then the second class does something ...
  • 1,119

1
2 3 4 5
18