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
0answers
6 views

How would I resolve a 429 error that does multiple api callouts from a scheduled class that calls multiple instances of a Queueable class

I have a scheduled class that calls a Queueable class which does an api callout. What seems to be happening is once the scheduled class is done setting up all of the queueable classes to run, they all ...
-1
votes
2answers
40 views

Help Needed to Bulkify Scheduled Apex Class PLEASE

Hello awesome Developers, I have the following scheduled apex class that I plan on running nightly or possibly a few times a day. The purpose of this scheduled class is to replace the standard ...
0
votes
0answers
14 views

Automatic SMS Message Notifications using Apex and not through flows

I am trying to send Automatic messaging notification from Apex. I am seeing that Automatic messaging notification can be sent through flows https://help.salesforce.com/articleView?id=sf....
0
votes
1answer
64 views

Is it possible to schedule a class every 14 days?

I am trying to schedule a class every 14 days based on a start date. Example: I want the scheduled job to run on 1st Tuesday of the month and 14 days off that i.e. 3rd Tuesday and then a 5th Tuesday ...
0
votes
0answers
21 views

Product and Catalog Data Translation through automation (preferable apex)

This query is specific to Salesforce B2B and Translation Workbench's new feature of Category and Product data translation. Importing and exporting of category and product translation through ...
0
votes
1answer
38 views

Scheduled Flow running apex class - callout error > System.CalloutException: You have uncommitted work pending [duplicate]

I am attempting to schedule a flow that runs every night and passes the dates of the previous two days into these variables, then calls the apex class to run. The variables are based on the time when ...
2
votes
1answer
19 views

Apex Class in Managed Package not showing when scheduling apex job

I have installed a managed package for an org under my user, but would like to transfer the owner of scheduled jobs to the admin. In order to do this I will need to delete the existing jobs and create ...
0
votes
1answer
26 views

Want Schedule Queueable apex job for every 20min , is it possible?

I have below Queueable class and want it schedule in each 20min, Please help me how we can do ? public class ExploreQueue implements System.Queueable, Database.AllowsCallouts{ public void execute(...
0
votes
1answer
23 views

Execute Workflow without user interaction

I have a requirement where I need to trigger a workflow without user interaction. I created a workflow that sends an E-Mail notification to the Opportunity Owner if Opportunity.CloseDate equals TODAY, ...
0
votes
1answer
63 views

Too many queueable jobs added to the queue: 2 Testing Help Needed!

I have a problem on my hands around getting enough code coverage for the below code I am working on. The Scenario: When a CPQ quote is being worked and it is a primary quote I have a process builder ...
1
vote
1answer
21 views

Allow users to perform a Job only after hours

I am trying to understand or come up with a solution for the issue we currently having in our Org. We have a situation that our Marketing users are adding the existing contacts to the Campaign which ...
0
votes
1answer
49 views

Multiple Emails via Apex Batch instead of one

We have a Batch Apex that loops over 9 Custom objects and sends out one email to each user who are assigned in any one of the custom object. This should send out one email to each even though if they ...
0
votes
2answers
27 views

Remove contacts from campaign using an apex class

I'm having an issue trying to get contacts removed from a campaign. I think it may be because I'm looking for campaign members instead of contacts, but I'm not entirely sure. I have the class set to ...
4
votes
0answers
60 views

Emails are not being received when sent through Apex

Below is my sendEmail Method . public void sendMail(List<user> Users, string emailTemplateName) { final string FROM_ADDRESS ='Test'; List<Messaging.SingleEmailMessage> emails = new ...
0
votes
0answers
22 views

Invoking inter dependent callouts from a managed package

I have a requirement, where I have a scheduled apex which runs every 5 mins and invokes a future method of an apex class. This future method invokes a managed package method for making the callout. So ...
0
votes
1answer
33 views

Why do I get the error “Callout from scheduled Apex not supported”?

I have scheduled the execution of my class and am getting an error. What did I do wrong and how do I fix it? global class SchedulableExchangeRate implements Schedulable { global void execute(...
1
vote
1answer
35 views

How to Send email to multiple user from batch apex

I am trying to create a batch that will run every day and will find the contacts which match the criteria. at the moment the code I have written is sending email to the same email address (time the ...
1
vote
2answers
123 views

Order of constructor execution for a class that implements a batchable as well as scheduleable interface

I am writing a batch class which should be scheduled to run at a certain frequency. I am putting both interfaces on same class - global with sharing class testbatch implements Database.Batchable<...
0
votes
1answer
17 views

Suppose I schedule a Schedulable batch job and my profile is “API User” and then it upserts

Suppose I schedule a Schedulable batch job and my profile is "API User" and then it upserts and a trigger runs to insert/update records. In whose context it will run? Who will show as "...
0
votes
1answer
37 views

Managed package installation is very slow for a customer

For one of our customers, we see that it takes unusually long to install a managed package using the Metadata API. The package has a few classes and custom fields. We receive a read timeout after 5 ...
0
votes
1answer
39 views

What is the cron expression to run salesforce batch for every 5 hours every day [closed]

What is the cron expression to run salesforce batch for every 5 hours every day, I tried using below cron but not working. 0 0 0/5 ? * * * So can you please suggest?
0
votes
1answer
51 views

Issues with testing a scheduled product index builder class (B2B commerce)

I wrote this schedulable B2B Commerce Product Index Builder class based on documentation from Salesforce and consulting a custom rep. global class ccScheduledProductIndexBuilder implements ...
0
votes
0answers
16 views

Authsession values not coming in scheduled batch job

List<AuthSession> lstAuthSession = new List<AuthSession>(); lstAuthSession = [SELECT Id, SessionType, UsersId, UserType, NumSecondsValid, IsCurrent, ParentId, LastModifiedDate FROM ...
0
votes
1answer
31 views

Batch apex state is maintaining but records are not storing in global List from different Batches

In the below batch apex class I'm not able to store different batches or transaction records in the global list, I used database.stateful also still I don't know why?????? Currently I'm getting ...
0
votes
2answers
42 views

Hourly Batch job not running as expected

We want to run a Batch job that runs hourly and updates the users to Inactive if they are logged in last 2 Hours but not 30 Minutes. The Code works fine when I run it manually and but i need to run ...
0
votes
1answer
41 views

Scheduled Apex Class Not Executing in Test Class [duplicate]

Hey guys so I’m having trouble with testing my scheduled apex class that is sending an email. The problem that is occurring for me is that when I click test, my System.assertEquals are not true ...
0
votes
1answer
91 views

Schedule a Cron job to run twice a week

I am trying to schedule a job to run on thursday and saturday for testing purposes. I researched and found several documents about how to do this but when implementing this in salesforce it is giving ...
0
votes
1answer
31 views

Code Coverage is passing in Sandbox with 84% but when deploying to prod its failing with 46% Code coverage

I'm deploying an apex class and Test class which is covering with 84% in Sandbox however when deploying in Production, its failing and says "Your code coverage is 46%. You need at least 75% ...
0
votes
1answer
54 views

System.SerializationException: Unable to load class:

I have a scheduled class for which I'm getting this error. Apex script unhandled exception by user/organization: 0052i000001fdsd/00D2i0000003dds Source organization: 00D46000000ttrg (null) Scheduled ...
0
votes
1answer
31 views

Running in to error First error: line 1:74 no viable alternative at character '"'

I'm trying to run a batch that makes user Inactive if logged in past 2 hours. It runs in to error ": line 1:74 no viable alternative at character" when i try to run this batch. I doubt if ...
0
votes
1answer
19 views

Issue with Batch Apex Updating Results from AggregateResults SQOL Query

I have an object Referral__C where we add a NHC_Tracker_ID(Nhc_Tracker__C another object). I want to update the fields on NHC tracker by count Referrals and Unique addresses related to Referral. My ...
0
votes
1answer
43 views

Batch Class calling Future Method Error

I have below scheduelable class but issue is after executing this it is triggering another class and calling future method.. i need my that future to be called but needs to avoid that error. (one ...
1
vote
2answers
24 views

test class on scheduled job simply stalls out

Sometimes it will run and give the 'this job already exists' or it just hangs for hours until it eventually decides to work...right now it's been hanging for 14 hours in a test environment. Everywhere ...
0
votes
0answers
31 views

Delete a schedule Job that execute a batch job after the batch is finish

We want to execute a schedule job after a change occurs in one of ours custom objects. The Idea is to execute a batch after 10 min with all the changes that occurred on that time period. For that we ...
0
votes
1answer
33 views

method not getting called inside rest api

I have created two rest API methods in the schedulable class when I called in the execute function my first method is called and worked fine in my First response my second method is not triggered. how ...
-1
votes
1answer
37 views

Dynamic Variable Scheduler Class

I'm looking to pass a variable to my scheulder class when scheduling a batch job. The idea is that I'm scheduling the class multiple times, but passing in a different variable each time. Example: ...
0
votes
0answers
190 views

Getting error in scheduled flow

Hi I have created a scheduled flow which will be fired before 30 days of expiration date on lead. But I am getting following error. SObjectRowId ={!$Flow.CurrentRecord} (null) Info Error Occurred: ...
0
votes
1answer
68 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
47 views

Unable to cover test class for batch apex [closed]

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
45 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
32 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
30 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
40 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
22 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
65 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
56 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
693 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
129 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
111 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(...

1
2 3 4 5
17