Questions tagged [scheduled-apex]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
24 views

Not Able to get fields from controller to Email Template when the mail is sent from scheulder

It would be great if I could get help with the below requirement that I have to achieve. The requirement is that I run a scheduler in a custom object called Project__c. Around 20+ projects pass the ...
2
votes
1answer
692 views

“Every 30 min” cron expression runs only hourly [duplicate]

I have a Lightning Component where users can choose how often an Apex Batch should be run. As options, I want to allow 30min, hourly and daily. Changing that should modify the CRON expression of a ...
2
votes
0answers
99 views

In a test class example of a Post Install script, sending an email and scheduling a class that performs an API callout

Scenario: In my example, as a part of the PostInstall (class implements InstallHandler) script I will be performing two actions; - sending an email to the installing User for the express purpose of ...
2
votes
2answers
190 views

Is system.schedule(…) @AuraEnabled?

I would like to know if system.scheduled is aura enabled or not. If not is there another methode that can replace it or a way to make it enabled? Edit final public class Plan { @AuraEnabled ...
1
vote
1answer
65 views

How to do this 'GET' through Batch?

I have a void callout class. But I need take all these tools through Batch to make it in Schedule later. How can I convert it into Batch structure with start, execute, finish? public static void ...
0
votes
2answers
75 views

unable to abort queued scheduled job

I have an apex job scheduled by mistake and now I cannot able to delete that. Due to that, I cannot able to edit my existing apex class. I tried the steps from Salesforce.com artice and when I execute ...
0
votes
0answers
156 views

How to make a Callout batch class?

I have a Callout with Lists and Maps. This takes objects from a resource and transfers them to my Lightning Component. How can I create Batch for this? I need Batch to schedule my callouts after every ...
0
votes
1answer
93 views

Schedulable error: You have uncommitted work pending. Please commit or rollback before calling out

I am trying to test Schedulable class which is designed to only run once. Because it's only runs once, I need to test that the System.abortJob is working correctly. I am using this code to test: ...
0
votes
1answer
152 views

Why my Batch is not updating the field

I am having one batch on Accounts which is not updating. I want to put the Sum of all the Normalized Accounts from all the invoices related to Accounts if the Status <> "invoice_canceled" and ...
1
vote
1answer
34 views

How to abort current scheduled job?

I would like to schedule a job to run once in 15 minutes time. According to this article: Run Scheduled Apex job once I need to add some code to the finish method: public void finish(Database....
0
votes
1answer
108 views

How many API calls can be made per hour to a non-bulk endpoint?

Assume that there was a REST endpoint that worked with 1 record at a time, i.e. not bulkified. If we were to use the Apex scheduler to pull down the records into SFDC every hour, what would be the ...
1
vote
1answer
83 views

Schedule Batch Apex too many rows

I am having an issue because I believe I don't understand batch apex/scheduling very well. Every time I use this I get either a SOQL error of trying to query too many rows of 50001, or a DML error ...
0
votes
1answer
61 views

Schedule class from the CronTrigger?

I have a requirement where I need give user an option to schedule a batch in a custom lightning configuration page. I can able to do it when we create a single schedule for a particular Batch by using ...
2
votes
1answer
973 views

System.StringException: Unexpected end of expression

Error: Line: 3, Column: 1 System.StringException: Unexpected end of expression. Class: public class OppSchedule implements schedulable{ public void execute(SchedulableContext sc){ ...
3
votes
1answer
548 views

How should I schedule multiple job of the same class?

I need to have a job that runs every 15 minutes. I checked out the documentation for Apex Scheduler and I came up with two solutions: 1-st: ScheduledJob job = new ScheduledJob(); System.schedule('...
0
votes
1answer
25 views

Can we run Scheduler class through another org?

I have a issue ,I have a source org and a target org ,i run a scheduler class from source org and it send data to taget org .Now i want to reschedule source org Scheduler class from target org . How ...
1
vote
1answer
260 views

How to find accidentally deleted scheduled apex job?

I cant find it anywhere even recycle bin, can someone help me how to find deleted scheduled job in salesforce?
0
votes
0answers
44 views

Schedule class doesnt work [duplicate]

Im having problems creating a schedule job in SalesForce. i have this class: global class dollarGetSC implements Schedulable { global void execute(SchedulableContext sc) { dollarGet....
5
votes
1answer
978 views

Enqueue Queueable class multiple times

I need to do five different callouts from my trigger. I'm planning to use one Queueable class for all the callout using the parameter passed in the constructor. I'm not sure if it is possible, if it ...
2
votes
1answer
570 views

Get the actual Previous Fire Time of a CronTrigger / Scheduled Apex

I am exeuting Scheduled Apex that should do processing based on the last execution time of the particular code. I query some records for processing and I only want to query those records, that have ...
1
vote
1answer
79 views

how to get details of deleted scheduled apex job. need exact cron query

we had a an old scheduled apex job running every 7 hours setup by a consultant. we deleted the job. we know the apex class that it used to call but we do not currently know the exact cron query or job ...
2
votes
1answer
142 views

Validation rule Scheduled Apex

I have a scheduled apex job which updates a field which is controlled by a validation rule as follows: AND( Not(ISNEW()), $Profile.Name != "System Administrator", ISCHANGED(...
1
vote
0answers
166 views

How to bulk query ContentDocumentLink for Scheduled Job

I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and ...
5
votes
2answers
129 views

How to disable asynchronous jobs so that they cannot update data

There will be a data export happening from our org for large number of objects and records using a cloud based ETL tool. We have a business scenario where we need to make sure that there is no data ...
0
votes
1answer
1k views

How to See Scheduled Job Run History

I have a scheduled job that is supposed to run every night at midnight. Recently users have said that the job didn't run; however this is sporadic, some nights it works and others it doesn't. Is ...
1
vote
1answer
196 views

How to manage versions of scheduled flows?

We have an autolaunched flow that we would like to run on a schedule. I have created an apex class to do so, but when testing the class, I discovered that it is encountering errors only associated ...
0
votes
1answer
978 views

Schedule a Queueable class

i am quite new to salesforce so i am not sure about this, and i wanted to get a clear answer since i haven't found one yet. Can i schedule a Queueable class that basically makes a callout to get and ...
1
vote
3answers
443 views

Need help-apex cpu time limit exceeded

I scheduled an apex job to run daily at midnight but noticed that the job failed due to the Apex CPU time limit exceeded error. The code works in my developer sandbox but not in production. I'm ...
1
vote
1answer
744 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
35 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
19 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
440 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
1answer
51 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
121 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
483 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
108 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
124 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
48 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
57 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
22 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
281 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
122 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
362 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
28 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
260 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
29 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
345 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
117 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
651 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
129 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 "...

1 2
3
4 5
16