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
166 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
68 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
537 views

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

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 incorrect signature: void schedule(String, ...
1
vote
2answers
470 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
573 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
428 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
44 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
785 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
179 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
120 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
231 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 ...
10
votes
1answer
2k 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
727 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
1k 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
595 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
316 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
108 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
225 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
92 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
221 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
640 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
83 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
229 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
1k 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
233 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
1k 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
2k 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
1answer
382 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
51 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
104 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
171 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
88 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
42 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
432 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
52 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
29 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
732 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
787 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
2k 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
57 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
54 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
289 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
184 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
29 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
516 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 ...
0
votes
2answers
59 views

Testing scheduled apex, Class variables seem to change after test

I am trying to test a small scheduled apex class: global class Vantage_Connector implements Schedulable { private Vantage_Messenger vm; public Vantage_Connector(Vantage_Messenger vm){ ...
0
votes
1answer
402 views

Create new sObject on parent object in for loop

I have the following data model - Accounts can have multiple Contracts Contracts have Billing_Unit__c and Cases generated on actions from external app I want to loop through all my Billing_Unit__c ...
1
vote
1answer
439 views

Callouts not supported in scheduled class

I have a scheduled class which needs to call to external WebService. Base on the WebService result - I'll need to run some logic - and call to additional update callout function. Since the callout ...
-1
votes
1answer
485 views

Getting batch id after scheduling a batch

I am using the method System.scheduleBatch , this method returns the scheduled job ID (CronTrigger ID). However, I need also the batch id because I need to monitor the bach. Is there any way I can ...
3
votes
2answers
3k views

What's the difference between AsyncApexJob and CronTrigger?

Roughly I know that when I schedule a Schedulable, I'm creating both a CronTrigger and an AsyncApexJob, but I'm confused as to how the two objects relate to each other and what the significance of ...

1 2 3
4
5
16