Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scheduled-apex]

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

1
vote
1answer
18 views

How to get CronTrigger ID of Scheduled Apex job when starting the Scheduler

I recently created a scheduled Apex job in a sandbox, then later tried to abort it and was unable to because I didn't have the CronTrigger ID and couldn't find it. I found several questions on ...
0
votes
1answer
11 views

Create a task if a particular if a date lapses? Scheduled APEX the only option?

I feel like I may be missing something obvious here, but I have a certain field that is populated with a future date. I would like to ensure that follow-up tasks are created when that due date lapses, ...
0
votes
1answer
13 views

Who is the sender for a SimpleEmailMessage sent inside an scheduled apex class?

If I have a scheduled job that periodically runs and queries a custom object, then creates a simpleEmailMessage and uses Messaging.sendEmail(), who will the sender for that email be? The user who ...
0
votes
0answers
25 views

Create Excel XLS from batch apex via Visualforce page

I have a scheduled batch apex that currently creates a .CSV document and attaches it to an email, but I have to change it, so instead of a .CSV file, I get a formatted XLS Excel document. Now, after ...
0
votes
0answers
9 views

Apex scheduler failing to execute scheduled job [duplicate]

I have an Apex Class an example below. global class EmailChasing implements Schedulable { global static void execute(SchedulableContext SC) { chaseEmail(); } public void chaseEmail(){} } Error ...
1
vote
1answer
39 views

Test classes for Scheduled Apex classes [duplicate]

Below I have shared the APEX code and the Test class code. I receive 100% code coverage, but I cannot grasp certain parts of it. Eg. The system.assert function - is it necessary? How do I know my test ...
0
votes
1answer
28 views

Batch and Schedulable Help

I'm trying to create a batch class that updates a set of number fields based on a particular profile that edits them and a schedule class that updates those changes every night at midnight. So far ...
0
votes
2answers
30 views

how to schedule a salesforce job every 3 months? [duplicate]

Someone know how to cron a salesforce job every 3 months, on the 1st at 9am? any ideas?
0
votes
1answer
29 views

Need help with Apex Batch job

I need to: Implement a batch job to Delete records that are past 60 days. Use helper class to implement the logic for deletion. Use the wrapper class in helper class to return the DML results to ...
0
votes
0answers
30 views

Trigger to fire after 10 seconds only ONCE

I have a use case where I need to do an Aggregate SOQL on OpportunityLineItem(oli) & its opportunitylineitemschedules(olischedules). I have 2 triggers(Trigger1 on Opportunity & 1 on oli). On ...
0
votes
1answer
17 views

Why my private static Map is empty on execute when it is filled in the constructor in apex batch class?

In the following code: global class MyBatch implements Database.Batchable<sObject> { ... private static Map<String, Id> mailTemplates = new Map<String, Id>(); ...
0
votes
1answer
27 views

Help with batch/scheduled apex

I'm trying to figure out the best way to transfer Account ownership of certain accounts once a day. I would use declarative tools but can't because the data that would fire the automation is coming ...
0
votes
1answer
14 views

Can i run 200 schedule with in 1 hour range with different name?

Based on the below link, I am aware that we can schedule the job upto 100 per hour. Can i schedule more than 100 job with different name. JobName1 - 20 JObName2 - 80 JobName3 - 80 - what happens ...
3
votes
1answer
28 views

Which scheduled jobs count towards the max concurrent scheduled jobs limit?

Per the docs we can only have 100 scheduled apex jobs at any one time in most orgs (5 in dev orgs). Which jobs count towards those limits? Would the following query return the right number? SELECT ...
-3
votes
1answer
33 views

System.QueryException: unexpected token: nullnull

I am doing a query from a field in custom settings. And updating the leads Here is my apex code public with sharing class textInputsConsecond implements Schedulable { public list<Lead> ...
1
vote
1answer
45 views

Invalid type for implements System.Schedulable Class [closed]

I have the following class which I try to schedule from the anonymous window but this gives the error: invalid type:abc_RiskSchedulerProcessor Class global class abc_RiskSchedulerProcessor ...
0
votes
0answers
25 views

Daily emails based on date field in Account object (Apex Class) - help?

I'm trying to create an Apex Class that checks all Account records on a daily basis and sends an email to the email field on ones that have a review due on that date. For example: Vendor ABC Pty Ltd ...
-1
votes
1answer
21 views

In apex how to know the whether a batch is schedule or it's running?

I want to know the status of a batch like whether it is schedule or it's running
0
votes
1answer
8 views

Scheduled Apex - Check if record meets criteria of latest date on a child record

I'd like to create Scheduled Apex to run overnight. The requirement is to remove sensitive information from a Contact if they have finished attending any courses they are booked onto (i.e. the ...
0
votes
1answer
29 views

Schedules Apex Failing - Attempt to de-reference a null object

I am getting the following error for a Scheduled Apex Job and don't know how to fix it (not a developer, just adapting some existing code). The aim is to update a field every night to trigger ...
0
votes
2answers
46 views

notify user by sending an email to user whose last-login is more than 1 day

Here is my code, please check global class LastLoginEmail implements Schedulable { global void execute(SchedulableContext SC) { List<User> uds =[SELECT Id, LastLoginDate, Email FROM ...
1
vote
2answers
44 views

Schedule apex class to run every year

I need the apex class to be scheduled at 1st January 12:00 AM every year how to achieve it? global class autoCreateIS implements Schedulable { global void execute(SchedulableContext arc) { ...
0
votes
1answer
22 views

Scheduled Job occassionally does not reschedule for next run

I haver a scheduled job that runs every fifteen minutes. It runs fine for several months and then randomly it will stop running and doesn't reschedule for the next run. The apex jobs showed an "...
2
votes
1answer
28 views

Schedule Apex to Update Leads based on Tasks

Problem: I have two fields on my lead object that I need to back fill information into. These fields are filled by looking through each of tasks off the lead; grabbing date/times off these records ...
1
vote
1answer
56 views

Is it possible to call a future static callout method from a scheduler

I have a static callout which i want to schedule every 5 minutes. How would i approach this I have tried the following but the the incorrect signature error: Callout public class or_service { @...
0
votes
3answers
38 views

Executing system.schedule scheduled class (Method does not exist or incorrect signature)

I might be having a completely dumb moment.. I'm trying to write a scheduler Apex class to create an Accounting Period every month and am getting an error when compiling Method does not exist or ...
1
vote
2answers
72 views

Query Limit on Batchable Class

What is the best practice with governor limits with Batchable classes and queries inside of the Batchable class? I am running into query limits with a Batchable class because I have too many ...
0
votes
0answers
86 views

Schedule apex class to run every day

I want to make some rollups on a custom objects via a scheduled Apex class. I managed to test the rollup via an Apex trigger, which fired whenever I edited the custom object. Now I want to run it ...
0
votes
2answers
76 views

Calling Batch Class from Scheduler Class for Multipe batches [closed]

I have a batch Class and Schedular Class. I am calling Batch class From Schedular class Multiple Time in Execute method.Is this a good practice? In Batch class i am doing callout and insert/update ...
0
votes
1answer
31 views

Unable to get the non duplicate Contact Emails from Child records

I have a lookup relationship between Order Line and Contact Objects where Contact is the parent. I am writing a batch class which looks for certain criteria on Order Line and send email to Contacts ...
0
votes
1answer
77 views

Why the Manage button in Scheduled Jobs is not visible

I scheduled 2 jobs in Developer Console: System.schedule('Scheduled Process Daily at 09:00 and 21:00', '0 0 9/12 * * ? *', new ScheduledProcess_1()); System.schedule('Scheduled Process Daily at 03:00'...
0
votes
1answer
37 views

Batch Scheduler Error

I have Created a batch scheduler which need to run for Every 5 min. but i am getting this error. can any one please help me out. Error: Compile Error: Method does not exist or incorrect signature: ...
1
vote
1answer
43 views

AsyncApexJob record when I use System.scheduleBatch() method

I have just found a very strange behavior regarding Batch. If I have a Batch and run it using the method Database.executeBatch(), a new record inside AsyncApexJob table is created and I can use ...
2
votes
1answer
37 views

Can not see “Manage” button in Scheduled Jobs

I have System Administrator Profile. The “View Setup and Configuration” checkbox is checked. When my CRON expression is like (monthly): '0 0 3 * * ?'; I can see the "Manage" button, but when my CRON ...
9
votes
1answer
357 views

Schedule and Run a Report as an specific User from Apex

Background What we are trying to accomplish is to run daily some specific reports as an specific user. So far From a lightning component we are allowing the user to select a reports list. Once the ...
1
vote
1answer
158 views

Batch Apex Too many SOQL queries: 201

I am getting Batch Apex Too many SOQL queries: 201 when the class is scheduled for run in developer console. Batch Apex: global class Batch_EmailBlast implements Schedulable,Database.Batchable<...
0
votes
1answer
166 views

How to use if(!Test.isRunningTest()){} for a specific test

I have a class with a callout and a unittest mock for the callout. The callout has a scheduler. If I create a unittest for the scheduler the scheduler tries to do a callout If i use if(!Test....
0
votes
2answers
51 views

How to write a unittest for scheduled apex

I have a scheduler for a callout class. I am trying to write a unittest for my scheduler but do not know how to test the execute part Class global class or_guestsSchedulable implements Schedulable{ ...
2
votes
2answers
83 views

Test a schedulable class with callout by directly invoking `execute`

I have a Schedulable class. My execute method has a future callout in it, and running it by using System.schedule doesn't run that callout: Test.startTest(); MySchedulableClass msc = new ...
1
vote
1answer
34 views

Update record using scheduled apex

I have a question about scheduler.. If I use scheduled apex to update a record of custom object, will the record last modified also updated? or only the targeted field?
2
votes
1answer
69 views

APEX Scheduled jobs stuck in queue status

I made scheduled class to get access token and save it to the custom object.. I set the scheduled jobs, using the UI (apex class > schedule apex), to run the class everyday.. but its not firing.. ...
0
votes
1answer
33 views

Variables in Schedule class losing values

I have a schedule class that class a batch class passing the source and target to merge child records from source to target. Below is the schedule class. global class FIMCConsolidationSchedule ...
0
votes
1answer
100 views

How to use Apex Schedule Job UI in custom lightning component without customization

We would like to create a lightning component to display the Apex Schedule Job UI(Customized), could anyone please let me know if there is any option to display Apex Schedule Job UI without ...
2
votes
3answers
198 views

Execute scheduled Apex class code on the Developer console

I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only. global class examExpiryAlert implements ...
0
votes
1answer
30 views

Batch apex class use fetch account data with Email Message

i wrote a Batch apex class, and i will fetch the all Account Records, But in account having Phone value is Null for Some Records, Those Records will be send to Admin user Email, How to do this ...
0
votes
1answer
70 views

Issues in Scheduled Apex

Error:First error: Delete failed. First exception on row 0 with id a2A0R000003T2DMUA0; first error: ENTITY_IS_DELETED, entity is deleted: [] Note: Above error occurs to me as a concurrency Issue. ...
0
votes
2answers
183 views

Best Practice to schedule a Batch

I am looking to find a best practice/framework to implement a schedulable batch. I don't know if create an Apex Class that implements Schedulable and Batchable interfaces is the correct way or create ...
-1
votes
2answers
88 views

Convert pseudo code in to a schedulable apex class to execute daily

Convert this pseudo code into an apex schedulable class. Exam name is a autonumber, which increments every time a new exam record is created, but is saved as a String value, not int. so inside this ...
1
vote
1answer
292 views

Batchable & Schedulable class has cyclomatic complexity of 48

Background I have a class which implements Database.Batchable<Sobject> and Schedulable and when I run PMD I get this problem: The class 'MyClassBatchJob' has a total cyclomatic complexity of ...
2
votes
1answer
259 views

How to get job id or job name from current running scheduled job

Can we get job id or job name from current running job? For example: global class MySchedule implements Schedulable { global void execute(SchedulableContext sc) { Id jobId = sc.getJobId()...