Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
2answers
23 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
15 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
23 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
51 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
31 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
63 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
51 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
66 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
30 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
52 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
23 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: ...
0
votes
0answers
20 views

Schedule a job with no end date [duplicate]

I would like to schedule a job to run forever with no end date, but the UI (schedule apex) doesn't allow me to proceed without an end date. Is it reasonable? I can assume in many situations the job ...
1
vote
1answer
34 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
27 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
259 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
94 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
69 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
33 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
44 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
votes
0answers
28 views

Automated-tracking of changes or insertion after Batch execution

In our org several batch are scheduled every night(all by the same user), in this scenario, manually keep track of these activities is impossible so I want to write a tool to do this. to A simple ...
1
vote
1answer
23 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
44 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
28 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
64 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
162 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
18 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
66 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
76 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
70 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
186 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
141 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()...
0
votes
0answers
23 views

How to use map to match 2 object record and return value that match

I have scheduled apex class to send email notification to user. it gave the user a list of all customer data stored in salesforce.. now I want to change the output.. from giving all customer data to ...
0
votes
1answer
76 views

How to Run Batch Class for Last 3 mondays of every month

I can not find any cron expression that allows me to run batch job for last 3 Mondays of every month. Lets say if current month has 4 weeks then I have to run the batch job for 2nd, 3rd and 4th Week ...
0
votes
1answer
27 views

CRON Check for all iterations

I have a scheduler with the CRON expression as 0 30 13 5-5 9-10 ? 2018-2018 From the above my thinking is it will run from sep 5th to oct 5th of 2018. But it's breaking in month end. Is there a ...
1
vote
0answers
30 views

Batch apex Stuck in Queue and never executes

We have a batch scheduled that runs early morning. It stays stuck in the queue and never executes. Is there any thing wrong in my code global class BatchAutoRefreshOpportunityRateDeck implements ...
0
votes
1answer
48 views

Not Able to reschedule apex batch class

enter code hereCurrently I have a batch which I'm scheduling after 2-2 minutes but because it has the same job name it doesn't allow to reschedule. Is there any way to reschedule the same batch. ...
1
vote
1answer
32 views

Is it necessary to create separate test classes for a Schedulable Class that triggers a Batch Class?

I have a Batch Class global class UpdateAssetInstallStatus implements Database.Batchable<sObject> { global Integer assetsProcessed = 0; global Database.QueryLocator start(Database....
-1
votes
1answer
37 views

unable to cover batch class completely [closed]

Scheduler Class: global class bankerjob implements Database.batchable<sObject> , Database.Stateful{ private EmailTemplate emailTemp; global bankerjob(){ emailTemp = [Select Id From ...
1
vote
1answer
71 views

Scheduling Class to insert new Records

I have written a Schedule Class to insert records when a certain record's date is four days ago. It should insert a new record but of a different record type. So for Example, if a package record type ...
0
votes
1answer
34 views

Link scheduled apex trigger to existing workflow

I just started to learn apex programming and i was wondering how to link apex trigger to existing workflow. For example, i do have a workflow that in a CASE changes a checkbox field old_case_c from ...
0
votes
0answers
21 views

Query an aborted CronTrigger

So I can query CronTrigger and see it's status, previous runs, next run time, etc. However, if I abort the job from SF UI, the record gets deleted. Now, there is some info on AsyncApexJob, but the Id ...
3
votes
2answers
177 views

Trying to access account geolocation fields in after insert trigger

I'd like to use the Salesforce account Geolocation fields (billing address latitude and longitude) to assign accounts to specific geographical zones. Salesforce automatically updates the billing ...
1
vote
1answer
96 views

HTTP POST Request with @future and schedulable

I need to create a schedulable Apex job which will send Sales Order Number from Case Object to my integration platform Web Service as JSON. This will be re-mapped and sent to another system, re-mapped ...
2
votes
1answer
304 views

How to schedule an apex batch with callout?

I am able to do callout using apex batch with user interaction (on demand). So when user click the button, this apex batch will run without any problem calling the apex batch: global class ...
2
votes
1answer
30 views

Apex Scheduled Job Staying in Queue

I scheduled a weekly APEX Job and it is only staying as QUEUED Status.. What is strange is that the job actually runs (the data modifications occur) but it does not 'Complete' Here is a class Public ...
2
votes
0answers
25 views

Permissions for a scheduled process initiated from InstallHandler

I've got a managed package which needs to start a batch process from a trigger. In order to deal with subscriber orgs who are also using asynchronous apex, my code tries to start it, then uses a "run ...
0
votes
2answers
57 views

Email reminder scheduler

I want to make a mail reminder that automatically send the email to my sales user every h+7 h+10 and h+15 created date.. how do I code the scheduler? using IF? for example, I want this mail reminder ...
2
votes
1answer
92 views

Apex class's behavior mysteriously changing after debug statement removed

I've run into a pretty maddening issue. The simple batch class below looks up certain campaign members and deletes them. It works fine, but when I comment out the debug statement on line 29, the ...
-2
votes
2answers
26 views

How Can i cover the below code in test class

public Pagereference CancelRec() { GS_Mass_Debrief__c headerrec = [Select id,name from GS_Mass_Debrief__c where Name =:Apexpages.currentpage().getparameters().get ('Name') limit 1]; ...
0
votes
2answers
56 views

Schedulable unit test fails assertion

I was doing the trailhead schedulable module and I was able to get all the points for the trail, but when I ran the unit test for it with my assertion, I was getting some strange behavior. Here is ...