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
2answers
24 views

Sending Email Reminders on Monthly and quaterly basis

I have a requirement where I have to send out email reminders on quarterly basic i.e.. twice. Once mid first month of quarter and on the end of 2nd month of quarter based on a condition (condition on ...
0
votes
1answer
13 views

Scheduling Scheduled Job from Managed Package

I want user of the managed package to be able to run a scheduled job that repeats every hour. The Scheduled Batch class is from the managed package and I'm having trouble accessing it when logged in ...
-3
votes
0answers
24 views

Get report on scheduled apex jobs [duplicate]

We have few apex job running everyday. I want the information about the scheduled jobs in excel on everyday basis.Below are the two queries which will give me what i want but how should i get this in ...
2
votes
1answer
161 views

How can I schedule a batch for every 2h (to run at half past?)

How can I schedule a batch every 2h (to run at half past?) like.. 00.30, 2.30, 4.30, 6.30, ..... 20.30 Thanks.
1
vote
1answer
28 views

Your organization has reached its hourly limit for processing workflow time triggers

There are a lot of similar question, but I'm trying to research why I get this message. I was looking into scheduled jobs and time based workflow. I am aware of the limits. Since I didn't find ...
-2
votes
0answers
14 views

Scheduled job every 20 minutes for every day [duplicate]

how can I run an apex batch every 20 minutes forever? I have no idea how to form CRON
0
votes
0answers
33 views

Create Field that Updates Automatically Each Time an Account is Merged

I'm currently having an issue with a trigger for a scheduled process on our Opportunity object. The trigger fires both before and after any updates to an opportunity, which causes a scheduled job to ...
-2
votes
2answers
58 views

Getting 'First error: Attempt to de-reference a null object ' error on Batch class execution

My batch is running without any error in lower environment, but when I scheduled batch apex in Production, it shows this error :First error: Attempt to de-reference a null object. I have tried to use ...
-3
votes
1answer
40 views

APEX JOB TO DELETE RECORDS

I have a demand and I need help to create an apex that is in Batch and delete all accounts with more than 10 years on the platform. I managed to get to the code below but I can't advance can someone ...
0
votes
1answer
25 views

Test two different scheduled apex classes from one test class

I have two different scheduled classes that I am trying to schedule from a single test class. A simplification is the first class creates a set of records, and then the second class does something ...
0
votes
1answer
51 views

Scheduled job is not querying the records as expected

I have a schedulable class(entire code is in schedulable class), which deactivates the users based on thier lastLoginDate(if lastLoginDate > 30 days) We have scheduled the job in production, which ...
0
votes
0answers
25 views

Unable to get code coverage for the test class for following Batch class on Case Object [duplicate]

I am new to Salesforce coding and trying to write my first test class. I have tried all day but can not get any coverage for this batch class. Can anyone please help me with the test class for this ...
1
vote
1answer
27 views

How to write the Test class for a Schedulable class which uses a custom label ( converted to date in the apex class)

This is my code ( apex class) below global class deleteclass implements Schedulable{ global void execute(SchedulableContext SC) { Datetime dt = DateTime.valueOf(System.Label.OldRecords); ...
0
votes
1answer
19 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
46 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
50 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
108 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
27 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
96 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
37 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
79 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
24 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
135 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
172 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
28 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
75 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
1answer
35 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
80 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
162 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
149 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
20 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
45 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
48 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
91 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
38 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
53 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
44 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
231 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
33 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% ...
1
vote
1answer
73 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
35 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
24 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
46 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
26 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
60 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
71 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
313 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: ...

1
2 3 4 5
17