Questions tagged [scheduled-apex]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

System.LimitException: Apex heap size too large: 9810745

I have a JSON too large to be deserialized, and I'm getting the Exception System.LimitException: Apex heap size too large: 9810745. I used ProjectClass= (ProjectClass) JSON.deserialize(jsonRequest, ...
-3
votes
1answer
33 views

Unable to cover test class for batch apex

I'm unable to run the test class for Batch apex. // This Schedule Class updates the Email Address of Inactive contacts whose Emp Termination date is over 30 days or Prac End date is Null global ...
1
vote
1answer
36 views

Do I have to implement the schedulable interface even if I only need it to run once and schedule a daily job?

I feel like i'm missing something basic here, I wrote a batch class that should be scheduled to run daily at a certain time of the day, forever. Do I really have to create an additional class that ...
0
votes
1answer
18 views

Scheduled end date in a custom report

I have custom report for scheduled batches i need fields included in the report Start date and END DATE of the scheduled jobs. I have checked these objects AsyncApexJob,CronTrigger,CronJobDetail but ...
0
votes
1answer
27 views

will the schedulable apex exceed if I run several call out functions in it?

for example, a schedulable that run two call-out functions like: global class scheduletest implements Schedulable { global void execute(SchedulableContext sc) { callOutFunction(a); ...
0
votes
1answer
35 views

Is it possible schedule an apex job to run several times everyday but during an interval time? [closed]

I am quite confused about the CRON expressions. I would like to run a job several times every day but in a time interval. For example: Every day run X job every 2 minutes from 3:00 am to 4:00 am. If ...
0
votes
0answers
19 views

Future method cannot be called from a future or batch method on Scheduled job

I have found this issue when trying to do a callout from an scheduled job and I can't get it to work properly. Schedule class: global class TM_LATAMCargaModeladoSchedulable implements Schedulable { ...
0
votes
2answers
37 views

How To Prevent creating Accounts In a specific month

I want to avoid Creation or Deletion of Accounts in a specific month(for eg December). How can I achieve this. Because the createdDate is null in before Insert and addError does not run in after ...
0
votes
1answer
33 views

CronTrigger.TimesTriggered is not incrementing after Test.stopTest() in Apex test class

I have a scenario in which an email is being sent to Users having admin profile at the end of the month for Closed Opportunities. Code seems to be working fine when tested in execute anonymous window ...
0
votes
1answer
48 views

Comparing Two Fields from Two Objects in Apex Scheduler

Whenever an account goes 18 months past the end date for the latest event that they have booked, we have code set up that will automatically change the account from being an active client to an in-...
1
vote
1answer
24 views

Email Alert from Scheduled Flow is Not sending

I have the following scheduled flow that calls all accounts and send an email alert. For some reason, none of the email alerts are being sent from the scheduled flow. We have been checking our spam ...
6
votes
2answers
96 views

How update Managed Packages (2GP) if one of the Apex classes is scheduled Apex

I often run into this error message: This schedulable class has jobs pending or in progress You can bypass this error by allowing deployments with Apex jobs in the Deployment Settings page in Setup. ...
0
votes
0answers
22 views

Setting batch size in a schedulable class run from dev console

I have the following schedulable class: global class OrderApprovalDeadlineScheduler implements Schedulable { private static BusinessHours bh; private static BusinessHours returnBusinessHours(...
2
votes
0answers
27 views

System.CalloutException: Callout loop not allowed when doing callout from Scheduled Flow

I am currently having an issue where my Callouts are returning an error: System.CalloutException: Callout loop not allowed The way the system works is this: I have a scheduled job that runs every ...
0
votes
2answers
25 views

Test unit for a scheduler

I have to develop a scheduler to process old registers of some object.. LastModifiedDate < LAST_N_DAYS:90 How can I create a test unit for such a scheduler? Is it possible to modify the ...
0
votes
1answer
44 views

Can one Schedule Apex Job run multiple times parallelly?

Scenario: I've created a Schedule Apex Job to run an 'X' class after every one hour. I will be running it through Developer Console using 'Anonymouse Execute Window'. The 'X' class inserts a large ...
0
votes
1answer
17 views

Exception: Invalid field for SObject Account

I have list which consists of field name. fieldList = new List<String>(); for(Schema.FieldSetMember memberObj : SObjectType.Account.FieldSets.rakch__DemoFieldSet.getFields()){ ...
0
votes
0answers
13 views

Testing schedulable apex class that sends an email [duplicate]

I am relatively new to Salesforce development (I'm an intern) and I am currently struggling with achieving 75% code coverage when testing a class that regularly sends out an email. I have included the ...
0
votes
0answers
19 views

Apex batch not committing records in production but executing without errors. Also working fine in sandbox

I have an apex batch which i tested in sandbox and it is working as expected but in production it is executing without error but not committing the records. I executed the same batch code in anonymous ...
0
votes
0answers
16 views

How to write a test class for a scheduleable class that sends an email? [duplicate]

I am fairly new to apex testing and am completely lost on how I am supposed to test a schedulable class that regularly sends an email. The class that I have written is below. It is very simple, and ...
0
votes
1answer
13 views

exceptions and scheduled jobs

I know if there is an unhandled exception it will "roll back" any dml operations that occurred during the same transaction. Does this also include scheduled jobs? I'm not sure if scheduling ...
0
votes
1answer
22 views

How to update a Scheduled apex class in Production?

Will I have to deactivate the scheduled apex class in test, make the changes and push it to prod ? Is it as simple as it sounds or is there a catch?
7
votes
1answer
87 views

Scheduled Apex with one-time execution not being executed

We have a number of Scheduled Jobs that are scheduled with repeat and these are all working fine. We have a handful of Scheduled Jobs that are dynamically scheduled and re-scheduled, either as one-...
0
votes
0answers
18 views

How to make a test class for a scheduled apex class? [duplicate]

I am new to salesforce and I have written test classes for only one class before which worked just fine. But how do I write one for a simple scheduled apex class. Here is the code below: global class ...
0
votes
0answers
16 views

Calling a managed class (in vlocity) in a batch class APEX

Is it possible to make a batch class then call a managed class from the vlocity? I'm trying to do this but I don't have an idea how to start it since I couldn't see the parameters needed for that ...
0
votes
1answer
26 views

Issue with the last 15 min of the hour when running a scheduler to be execute after 15 min

We have a Campaign which has a field that counting available sits. When a user is filling it personal data within a form, and submit the page, he redirects to a payment site (other system). I want to ...
2
votes
0answers
54 views

Scheduling a Managed Package Class from Anonymous window getting Invalid Type Error

I have a "SchedulableClass" class in a managed package. I want to schedule the class to run for every 5 mins in my org by Anonymous block, Below is the code System.schedule('Schedule Job ...
0
votes
0answers
17 views

Schdulable class doesnt send emails on product org while same code works in test org

Im testing the code in Anonymous Window with this code: NotificationNameOptions abc = new NotificationNameOptions(); abc.execute(null); On production org I get this error: Line: 12, Column: 1 System....
0
votes
1answer
40 views

Test Class Coverage for Scheduled and Batch Classes

I am attempting to test a scheduled class that calls a batch class to update records. The following test class does not seem to find the Opportunity being created in the test class to pass that list ...
0
votes
0answers
20 views

Scheduling apex class through Processbuilder issue?

Hope all are doing good and safe. I have small issues with my class on scheduling through process builder.In my visualforce page I have a "apex:outputLink" by using this I'm executing some ...
0
votes
1answer
43 views

How to add 1 hour to record created date to run a Apex scheduler?

Hello All i am trying to run an Apex scheduler which i need to fire once if the DML fails in catch block. How to add 1 hour from the datetime where the exception is caught on the fly? catch(...
-1
votes
1answer
38 views

Difference between System.today() and System.today().day() in apex?

I have a schedule apex job that runs everyday in the morning at 2 AM, where I am trying to gather opportunities where custom date Reoffer_Date__c as today. List opportunitiesList = [ SELECT Id,...
0
votes
0answers
21 views

Dynamically Scheduling Apex to Run at Various Points in Time for different set of records [duplicate]

My use case is that our Salesforce org will do callout to external system at different times of the day. All these data are stored in a custom object, which basically stores the external system URL ...
3
votes
1answer
95 views

Is there a way to change deployment settings using sfdx or on scratch org creation?

The deployment settings (Setup > Deploy > Deployment Settings) contain a Boolean "Allow deployments of components when corresponding Apex jobs are pending or in progress" which ...
-2
votes
1answer
36 views

Is there any alternate ways to handle string in a better way in the below batch class. I feel it looks ugly? [closed]

global class batchFileUpdate implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database.BatchableContext BC) { string reseller= 'RENEWAL_RESELLER'; ...
0
votes
0answers
15 views

IsAvailable returns false even when the user profile has Record types assigned

IsAvailable returns false even when the user profile has Record types assigned. Prototype of code below : List<Schema.RecordTypeInfo> rt = Case.SobjectType.getDescribe().getRecordTypeInfos(); ...
0
votes
1answer
40 views

How do I query on user object to pull out records that they are involved in 5 unrelated objects?

I'm new in Apex, I'm running a schedule apex to send out email notification to Assigned_Reviewer__c on Custom object called "Patient relations Review" if the record status is "In ...
0
votes
1answer
322 views

Schedule Apex Class — Error: You must select an Apex class that implements the Schedulable interface

Has anyone ever come across this error while attempting to schedule a Schedulable Apex Class? Error: You must select an Apex class that implements the Schedulable interface. I had previously been ...
0
votes
1answer
33 views

Scheduled Apex not firing

Still fumbling my way through this problem: Help understand Apex class / bulkilfy I decided to go ahead and create a query in Apex that gets the Leads I need to be reassigned and push those into the ...
0
votes
0answers
37 views

Apex Scheduler - CronTrigger gets created but doesn't run

We are running into an issue with the Apex Scheduler. We've scheduled some code to run every half hour. Since the ".schedule()" method only allow to run code hourly, we call the method twice ...
0
votes
1answer
35 views

Test class not covering my batch

I'm new to batch scripts. In my apex batch My start method will send records to execute method based on input given in custom label. I have created a test class and I'm not sure my execute method is ...
0
votes
2answers
28 views

Managed package component to run apex class daily

I have a managed package that users will install to their org. I want to somehow run a task daily that will build an aggregate a list of Events created that day, format it into an email body, and send ...
0
votes
3answers
42 views

Issue Covering Public void execute(Database.BatchableContext BC, List<sObject> Name_of_list)

I'm at about 26% covered missing the Execute method for the most part doesn't appear to be firing. Here is the code I have: public class UpdateFutureCasesToNewStatus implements Database.Batchable<...
0
votes
1answer
22 views

Testing a schedulable class executing batch apex gives inconsistent results

@isTest(seeAllData = false) private class interfacetest { public static testMethod void testInterfaceScheduler(){ Product2 testproduct = new Product2(Name='test product',ProductCode = '...
0
votes
0answers
104 views

Automated Process has no Access to Connect API - System.NoAccessException: Insufficient Privileges: The Connect API is not enabled for this user type

I have a batch that does callouts. This batch when I tried to schedule, gave me an error "Callouts not supported from Schedule class". I thought about the future, but that does not work as ...
2
votes
1answer
54 views

Scheduled Process owned by Ghost user

I recently came across a salesforce package that uses the ghost user to schedule a process during the install/upgrade. One of the things it does is it creates records. I've been trying to replicate ...
0
votes
0answers
36 views

Writing test class for Messaging.sendEmail()

I am having an issue while writing a test class for a method that sends a report as an attachment in a scheduled email. My method looks like this: @future(callout = true) public static void ...
0
votes
1answer
43 views

Handling a combination of async callouts, schedulable jobs, and queueable jobs

The current requirements for my system is as follows: When a certain change is saved on the Account object, I need to create an Order object and make a callout to Service A. Service A finishes ...
1
vote
1answer
45 views

Scheduled apex class not updating records and test not covering

I have been working on a scheduled apex class to update cases when their status contains future and when the my field (date/time)future date of completion = today. My problem is that its running and ...
0
votes
0answers
11 views

Temporarily Disable Users updating forecasts

We are using collaborative forecasting with type of Opportunities by territory. I have a need to disable users from entering their forecasts during certain period of time in a week. For example, every ...

1
2 3 4 5
16