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 [schedulebatch]

Class than can be scheduled to run at a certain time and invoke a batchable class

0
votes
1answer
17 views

How to update a value in finish method of Database.Batchable

I am implementing a callout in Database.batchable public with sharing class BatchDocusignStatus implements Database.Batchable<SObject>, Database.AllowsCallouts { public Temp_REST_Auth__c ...
-2
votes
0answers
31 views

how to use constructor with two parameters in batch apex and how to write test class for the same?

While covering the below batch apex im getting a error 'System.UnexpectedException: Start did not return a valid iterable object.' I exected the batch class like: batchClass b = new batchClass(idSet,...
0
votes
0answers
19 views

Scheduling a Batch Job dynamically?

I have a batch job which I want to be schedule dynamically according to a sunset time api ( which means that the sunset time is different each day). How can I do so?
0
votes
1answer
24 views

How to have a batch call itself to rerun, but wait 60 seconds before calling itself?

I currently have a batch which calls itself if it finds records still falling into scope. I am using a static boolean variable to do this. Now i have found out our email system cannot handle thousands ...
1
vote
2answers
45 views

When is a batch class instantiated when you schedule it?

QUESTION: when you instantiate a class in a scheduled apex job, is the class instantiated at the time of the schedule, or at the scheduled time of execution? Here's my situation... I have a custom ...
0
votes
1answer
32 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
36 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
21 views

Schedulable Batch Errors

I'm trying to write a schedulable batch class that runs every night at midnight that updates these particular fields. I keep recieving these error messages and I dont understand why I keep getting ...
0
votes
0answers
32 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
18 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
30 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
25 views

Email not been sent from the finish method of a batch job in a unit test

The below code is to validate if an email has been sent from the finish method of a batch job using the Limits.getEmailInvocations(). The afterEmail variable is been set to 0 and no email is been sent ...
0
votes
1answer
15 views

How to make a call out from batch which (batch) get schedule from trigger?

I'm trying to call a method which do an api call. But I'm getting an error because this method get call through the process ran by batch and this is getting schedule from trigger. So even if i ...
0
votes
1answer
61 views

Multiple Nested Loops in Apex

Background: I have 3 objects: Contacts, Accounts, Campaign, that are involved in the scenario. Contact is the parent object, Accounts and Campaigns are child objects to contact(Related Lists) There ...
0
votes
2answers
30 views

Archive Accounts [closed]

What is the best way to archive accounts, after we have identified them as obsolete. ? I want to automate the process of archiving the obsolete accounts. These accounts become obsolete under two ...
-1
votes
2answers
64 views

Iterable Batch Apex

I want to write a batch class and need to make a webservice callout from it. Once the response is returned in Json format. I want to process the same into objects of salesforce. So I know how to make ...
0
votes
0answers
25 views

Is it possible to schedule sending a VF Page via Email?

We have this requirement that says we need to schedule once a month the sending of a VF page that contains custom dashboard charts via email. So if we break this requirement down, we need to do the ...
1
vote
1answer
33 views

Find what apex a cronjob Triggers

Scenario: Documentation on my org has a gap regarding a scheduled batch apex. This batch code updates a related list on the lead object. This List and process is call ‘nearby references’ and ‘find ...
2
votes
1answer
60 views

Why Would Batchable Not Run the Specified Scope Limit?

I call to a batch class on 204 records: PaymentAgreementMonitor myBatchObject = new PaymentAgreementMonitor(); Id batchId = Database.executeBatch(myBatchObject, 66); When it runs, it is running on ...
1
vote
2answers
76 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
2answers
81 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 ...
1
vote
1answer
53 views

Batch Test Class works in Production, Fails in Test

I've started a new job and the test code coverage here is poor. I am working to improve this and one of the batch classes has coverage of 77% in production. This is now below the org % so I thought I'...
0
votes
1answer
45 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
2answers
26 views

Ways to schedule a class in Salesforce [duplicate]

I want to know different ways by which I can schedule a class in salesforce!? I know we can do it using Developer console and SetUp.. But what are other ways by which we can schedule a class?
1
vote
1answer
54 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 ...
1
vote
1answer
25 views

Issue with batch which is scheduled for every 5 minutes and didn't run for 24 hours and 5 minutes

we have batch which is scheduled to run every 5 minutes. This batch was working well for few months and then on 7th of November it didn't run for 24 hours and 5 minutes. After that, it is running ...
0
votes
1answer
96 views

Can we schedule a apex class at a time in different time zones

We have a batch class to updates events dates. But all the users are not in same time zone.Some users are in Uk,Some are in USA,Some are in India..etc My batch class will run every day at 1 am of ...
1
vote
1answer
35 views

How to change concurrencyMode Apex batch

The documentation (Unable to lock row - Record currently unavailable errors ) says to change 'concurrencyMode' to Serial instead of Parallel. But I can't find how to change this property in apex ...
3
votes
1answer
134 views

How can I delete/abort all scheduled jobs for a particular apex class?

I need to delete/abort all schedule jobs associated with a particular apex class. There are nearly 1500 scheduled jobs in my org. Any tips on how to approach this?
0
votes
2answers
70 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{ ...
0
votes
0answers
22 views

Which Salesforce IP range to whitelist for an integration through scheduled apex batch

My situation is the following: I have a batch that is scheduled to run every hour, which does a callout to an external system. My org is located in the APAC region, but the user that scheduled the ...
1
vote
1answer
63 views

What are the design patterns how to do a batch callout

I know some basics on callouts but would like some advice on doing multiple callouts. Requirements: I have an external system where guests are registered this could be large amounts. I have to get ...
0
votes
1answer
37 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
2answers
240 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 ...
0
votes
1answer
55 views

Schedule batch job using cron expression

I have a requirement where I need to schedule a batch job 4 times in a day, at 1 AM EST, 10 AM EST, 3 PM EST, and 8 PM EST. I have scheduled this using a cron expression in Developer Console. I ...
3
votes
1answer
220 views

batch apex finish method to schedule another batch job with scope of 100 due to callout limit

The schedule_batch_mdm_role_definition I believe is working fine. global class schedule_batch_mdm_role_definition implements schedulable { global void execute(SchedulableContext sc) ...
0
votes
1answer
117 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 ...
1
vote
2answers
56 views

Test Class for batch job, how to cover execute method

I am trying to write test class for a batch job, but I am not able to cover the execute method and to enter in it in order to debug my class. How can I cover this method? Batch job: /** * ...
0
votes
1answer
55 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
37 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
vote
1answer
351 views

First error: Exceeded maximum time allotted for callout (120000 ms)

I have a Batch class making an API callout and I have scheduled this class. I have used a for loop to iterate through the page number variable in my API endpoint. There are 64 pages. Strangely, if I ...
2
votes
0answers
64 views

Scheduler test class fails while packaging

Scheduler Class: global with sharing class Demo_Scheduler implements Schedulable { global void execute(SchedulableContext sc) { Database.executeBatch( new Demo_Batch(new List&...
1
vote
1answer
111 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
19 views

Endpoint can not be null issue in scheduled batch callout job

I struggle with execution of HttpRequest POST in my Scheduled Batch job. I have written Test and Mock classes to test the callout itself (without Batch job) and it returns http code 200. My debug ...
0
votes
1answer
38 views

Retrieve information from other Org using REST Callout

I am new in salesforce and i have a REST request callout to retrieve the information from the other ORG. My problem is, I don't know if my code is correct since there is no error but in my VFPage, ...
2
votes
1answer
486 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
97 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 ...
0
votes
2answers
235 views

Test class for Scheduled Batch class making a callout in the start method

I have two classes - BatchClass and SchedulerClass. Batch class makes an API callout in the start method and return the list of records to insert. This class is scheduled with the help of ...
0
votes
1answer
92 views

Salesforce: how to send email alerts on specific dates in salesforce using schedule apex?

I want to send email alerts to user which are lookup with account (user field is lookup in account) at the start of every quarter, based on a picklist. My proposed picklist values, and their desired ...
-1
votes
1answer
173 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 ...