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
1 answer
23 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?
user avatar
0 votes
1 answer
26 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
-1 votes
1 answer
41 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 ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
-2 votes
1 answer
36 views

For the Apex jobs that failed to execute, what is/should be the next action we need to take in order to determine the job run time?

For the Apex jobs that failed to execute, what is/should be the next action we need to take in order to determine the job run time?
user avatar
0 votes
0 answers
30 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 ...
user avatar
-1 votes
1 answer
35 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 ...
user avatar
  • 5
10 votes
2 answers
226 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 ...
user avatar
0 votes
0 answers
49 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{...
user avatar
0 votes
1 answer
62 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
  • 5,435
0 votes
1 answer
45 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 ...
user avatar
  • 131
0 votes
1 answer
43 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....
user avatar
0 votes
2 answers
238 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 ...
user avatar
0 votes
1 answer
254 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 ...
user avatar
0 votes
0 answers
38 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
34 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
0 votes
0 answers
142 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 ...
user avatar
1 vote
1 answer
54 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
0 votes
1 answer
53 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: ...
user avatar
  • 3
1 vote
1 answer
237 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
2 answers
236 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 ...
user avatar
0 votes
1 answer
96 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 ...
user avatar
  • 11
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
  • 138
1 vote
1 answer
47 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 ...
user avatar
  • 21
0 votes
0 answers
37 views

Create Field that Updates Automatically Each Time an Account is Merged

I'm currently having an issue with a trigger for a scheduled process on our Opportunity object. The trigger fires both before and after any updates to an opportunity, which causes a scheduled job to ...
user avatar
-2 votes
2 answers
235 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
140 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
0 votes
1 answer
58 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 ...
user avatar
  • 1,119
0 votes
1 answer
85 views

Scheduled job is not querying the records as expected

I have a schedulable class(entire code is in schedulable class), which deactivates the users based on thier lastLoginDate(if lastLoginDate > 30 days) We have scheduled the job in production, which ...
user avatar
  • 41
0 votes
0 answers
25 views

Unable to get code coverage for the test class for following Batch class on Case Object [duplicate]

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
1 vote
1 answer
32 views

How to write the Test class for a Schedulable class which uses a custom label ( converted to date in the apex class)

This is my code ( apex class) below global class deleteclass implements Schedulable{ global void execute(SchedulableContext SC) { Datetime dt = DateTime.valueOf(System.Label.OldRecords); ...
user avatar
  • 11
0 votes
1 answer
85 views

How would I resolve a 429 error that does multiple api callouts from a scheduled class that calls multiple instances of a Queueable class

I have a scheduled class that calls a Queueable class which does an api callout. What seems to be happening is once the scheduled class is done setting up all of the queueable classes to run, they all ...
user avatar
  • 13
-1 votes
2 answers
50 views

Help Needed to Bulkify Scheduled Apex Class PLEASE

Hello awesome Developers, I have the following scheduled apex class that I plan on running nightly or possibly a few times a day. The purpose of this scheduled class is to replace the standard ...
user avatar
  • 53
0 votes
0 answers
131 views

Automatic SMS Message Notifications using Apex and not through flows

I am trying to send Automatic messaging notification from Apex. I am seeing that Automatic messaging notification can be sent through flows https://help.salesforce.com/articleView?id=sf....
user avatar
  • 59
0 votes
1 answer
420 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
0 answers
36 views

Product and Catalog Data Translation through automation (preferable apex)

This query is specific to Salesforce B2B and Translation Workbench's new feature of Category and Product data translation. Importing and exporting of category and product translation through ...
user avatar
0 votes
1 answer
319 views

Scheduled Flow running apex class - callout error > System.CalloutException: You have uncommitted work pending [duplicate]

I am attempting to schedule a flow that runs every night and passes the dates of the previous two days into these variables, then calls the apex class to run. The variables are based on the time when ...
user avatar
2 votes
1 answer
159 views

Apex Class in Managed Package not showing when scheduling apex job

I have installed a managed package for an org under my user, but would like to transfer the owner of scheduled jobs to the admin. In order to do this I will need to delete the existing jobs and create ...
user avatar
0 votes
1 answer
292 views

Want Schedule Queueable apex job for every 20min , is it possible?

I have below Queueable class and want it schedule in each 20min, Please help me how we can do ? public class ExploreQueue implements System.Queueable, Database.AllowsCallouts{ public void execute(...
user avatar
0 votes
1 answer
28 views

Execute Workflow without user interaction

I have a requirement where I need to trigger a workflow without user interaction. I created a workflow that sends an E-Mail notification to the Opportunity Owner if Opportunity.CloseDate equals TODAY, ...
user avatar
0 votes
1 answer
462 views

Too many queueable jobs added to the queue: 2 Testing Help Needed!

I have a problem on my hands around getting enough code coverage for the below code I am working on. The Scenario: When a CPQ quote is being worked and it is a primary quote I have a process builder ...
user avatar
  • 53
1 vote
1 answer
23 views

Allow users to perform a Job only after hours

I am trying to understand or come up with a solution for the issue we currently having in our Org. We have a situation that our Marketing users are adding the existing contacts to the Campaign which ...
user avatar
  • 599
0 votes
1 answer
560 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
2 answers
47 views

Remove contacts from campaign using an apex class

I'm having an issue trying to get contacts removed from a campaign. I think it may be because I'm looking for campaign members instead of contacts, but I'm not entirely sure. I have the class set to ...
user avatar
  • 13
4 votes
1 answer
145 views

Emails are not being received when sent through Apex

Below is my sendEmail Method . public void sendMail(List<user> Users, string emailTemplateName) { final string FROM_ADDRESS ='Test'; List<Messaging.SingleEmailMessage> emails = new ...
user avatar
  • 41
0 votes
1 answer
57 views

Invoking inter dependent callouts from a managed package

I have a requirement, where I have a scheduled apex which runs every 5 mins and invokes a future method of an apex class. This future method invokes a managed package method for making the callout. So ...
user avatar
  • 3
0 votes
1 answer
454 views

Why do I get the error "Callout from scheduled Apex not supported"?

I have scheduled the execution of my class and am getting an error. What did I do wrong and how do I fix it? global class SchedulableExchangeRate implements Schedulable { global void execute(...
user avatar
1 vote
1 answer
1k 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
286 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

1
2 3 4 5
17