Skip to main content

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
1 answer
74 views

Update field in Schedule Apex directly or use batch apex?

This question is more about with approach is ideal to follow. Scenario: I need to udpate a field value in some of the records once every week. Should the logic to update the field be present directly ...
coder123's user avatar
  • 129
-2 votes
1 answer
50 views

Advantages of Scheduling through Apex than compared to the UI [closed]

I'm exploring the options for scheduling tasks within Salesforce, and I'm particularly interested in understanding the benefits of utilizing Apex for scheduling compared to using the built-in UI ...
Rahul Allada's user avatar
0 votes
0 answers
30 views

What could cause a apex scheduled batch class to run but not update records even when unit tests have passed?

I spent hours troubleshooting my batch class but I cannot get it to update records. The ask is if a Opportunity closeDate >15th of the month, and CareStatus__c = 'ADM','AAMT' than ...
LegendofLegends's user avatar
0 votes
0 answers
31 views

Code Coverage issue for my scheduled class [duplicate]

In have been written a schedule apex class to send an email to users where the opportunity not modified by 14 days, the class is working fine I am writing the test class which it is not covering the ...
Naveen Varada's user avatar
0 votes
1 answer
63 views

CSV report generation using apex batch

I am trying to generate the csv report by fetching the data from ApexTestResult obj. But the column 'message' in the apextestresult obj is overlapping and automatically divided the message and showing ...
RKCY's user avatar
  • 323
0 votes
2 answers
56 views

Test Class coverage on execute method of Batch Apex which is Scheduled to run at specific interval of time

I have a Batch class, which queries Lead records that were created 1 day before. I have created a custom Label 'More_Than_1_days' which has the value 1. I was using this custom label in that batch ...
Mohd hasim's user avatar
-1 votes
1 answer
64 views

Can't find the apex class in scheduled apex [duplicate]

how to find the apex class in this scheduled apex record.its not showing the apex class , then I try this in apex jobs section but it's also not showing. Please give me solution for that . How do I ...
Pamoda Wijesinghe's user avatar
-1 votes
1 answer
100 views

How to create different kind of scheduled apex jobs [closed]

How to create the following apex jobs(Types) Reporting Notification Sitemap SEO Generation Job Sitemap SEO Incremental Job Can you explain these apex job types and how to create these jobs in ...
Pamoda Wijesinghe's user avatar
0 votes
1 answer
470 views

Is there a way to schedule a flow to run three times in a day?

I wrote an Apex class and I have used that class in Schedule-Triggered Flow, and I want to schedule it to run thrice a day. While searching about I found that I have to create a Schedule-Triggered ...
Prince Sharma's user avatar
1 vote
0 answers
43 views

Triggering Scheduled Job During Unlocked Package Installation/Upgrade

Within our unlocked package, we have implemented a class TimesheetWindowScheduler that implements the Schedulable interface. This class is responsible for executing specific tasks. public with sharing ...
vctqs1's user avatar
  • 95
-2 votes
1 answer
749 views

Which is a better approach when updating records using batch class, to place it in execute or finish method?

Sorry but I am new to this and I just wander, do you think it is better to put all the millions of records inside the Map object which is process by the execute method, however the dml where the ...
Kato's user avatar
  • 1
0 votes
1 answer
30 views

Account deletion job based on object relations

I have a requirement for creating a job for deleting the accounts that do not have related cases, opportunity, Lead. The 3 objects can also change in future and new object to be checked can be added ...
user15754268's user avatar
0 votes
2 answers
133 views

Apex Schedule Job Error - When triggering a Flow

I have created an apex class and executed anonymously a code which forces my flow to run every hour, but I am getting this error If you use a record variable to update or delete records, the ID value ...
Dharmin's user avatar
0 votes
1 answer
58 views

Running apex scheduled job automatically getting removed

I have written a scheduled class which will run after every 1 min. From Scheduled Job I am calling a queueable class. Also, for rescheduling after 1 min, I have a platform event which will fire after ...
Sukruti's user avatar
  • 472
0 votes
0 answers
603 views

Setting batch size on scheduled apex with batch execute(Database.BatchableContext bc, List<SObject> results)

I have a scheduled batch that I need to adjust the batch size on. I've seen articles where the batch size is managed in the batch class' execute() method, but only when the execute method is in the ...
Duncan Stewart's user avatar
0 votes
1 answer
165 views

Execute a batch with custom delay between each batch processing

I have a batch class which update the primary field on the quote object using batch size of 1. I need to do this in such a way that each batch is processed 30 seconds after the previous one(there ...
Tony Jude's user avatar
1 vote
1 answer
208 views

Troubleshoot Test Class for Schedulable Apex with Email Message

My schedulable apex is working properly and I have 100% test coverage on it, but the test is not giving me the System Assert I am expecting and I'm hoping someone can spot the reason why. The Apex ...
Kendra Broom's user avatar
0 votes
2 answers
463 views

Is it guaranteed that First submitted Queueable or Batch class will run first?

We have to send case create and update data via API to third party. For create case: In trigger we are collecting all the case ids in set and calling queueable class if cases created are less than 100 ...
Sukruti's user avatar
  • 472
-2 votes
1 answer
557 views

How to remove permission set from deactivated user using apex

Inactivate users when their last working day is today. Capture the users last working day in a custom field on user. Batch will run every day once. Remove the permission sets assigned to the user ...
tejas vir's user avatar
3 votes
1 answer
369 views

Interface, System.Schedulable, relationship must be maintained: org deployment error

I am deploying code to 1st generation packaging org. The deployment steps we follow is: Convert the code base to metadata api format from sfdx format Execute the command to deploy the code to ...
Amit's user avatar
  • 354
1 vote
1 answer
477 views

CANNOT_UPDATE_CONVERTED_LEAD Apex Error - Update

I've created a scheduled flow that triggers on the following conditions: Lead has a related account via a Lookup Lead Has_Activity__c = True Lead IsConverted = False When this is scheduled to ...
andrew's user avatar
  • 149
0 votes
1 answer
174 views

Unit testing nested asynchronous jobs

I'm trying to make my tests pass but I can't. I have My Queueable Class: public class MyQueueable implements Queueable, Database.AllowsCallouts { public MyQueueable() {} public static void ...
FarKorE's user avatar
  • 25
0 votes
1 answer
117 views

Help-Logic to check if the submitted date/time is after 2PM and skip the update of that record- Batch class

This is the sample batch class that I am working on. This class is working fine but I need to add one more condition like, If status is set to submitted after 2PM, The number field should not be ...
sangeetha balasubramanian's user avatar
0 votes
1 answer
119 views

Is this a true statement that package upgrade allows to include changes to Schedulable jobs scheduled or in progress?

Usually I ask questions about why something is broken in Salesforce, however, today I want to ask a different question. We know that we can't deploy unpackaged code which introduces changes into ...
Patlatus's user avatar
  • 17.3k
1 vote
0 answers
101 views

How to prevent the parent Queueable Job from having a 'Complete' status until the chained child Queueable job completes?

This is more of a theoretical question. I have an action button on a VisualForce page which downloads a PDF with large data. When the action button is clicked, it invokes a Queueable job through the ...
Knight of the Vale's user avatar
2 votes
1 answer
286 views

Omni Routing Queue Threshold Alert

We use Omni Routing for our live chat and one of the features in there is the Omni Supervisor which shows some metrics on queues such as wait times. There is a request where leadership in the call ...
SBB's user avatar
  • 173
3 votes
2 answers
525 views

What is the reason behind the runtime error when Queuable jobs in enqueued?

If a public class implements both Schedulable and Queueable interface public class A implements Schedulable, Queueable { public void execute(SchedulableContext c) { // } public ...
Patlatus's user avatar
  • 17.3k
3 votes
1 answer
2k views

Is it possible to call a LWC from Apex?

I need to create a PDF document completely customizable and I decided to use an external JS PDF generation lib (PDF-lib) to create the documents from a LWC instead of using the Visualforce PDF method. ...
Luis Fernando Kumruyan's user avatar
0 votes
0 answers
278 views

Apex Unit test Database.UpsertResult

I have this following code. The SubId__c is an external and a unique key in FKS_Subs__c object. This object gets data from FKS_Subs_Delta__c object everyday as a scheduled batch job. If it tries to ...
Mujahid's user avatar
  • 121
0 votes
1 answer
169 views

Test class for records owned by System User

I have batch job class which fetches ServiceAppointment where Owner.Name = 'System User' in it's Database.QueryLocator start method. global class CancelDuplicateSaBatchClass implements Database....
Ravi's user avatar
  • 1
0 votes
0 answers
591 views

Test class and code coverage for FSL ServiceAppointment

I have below class for which I am writing test class. global class FSL_ScheduleSABatch implements Schedulable, Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful { global ...
Ravi's user avatar
  • 1
-1 votes
1 answer
199 views

Scheduled Apex in waiting for more than a week

I have a couple of scheduled apex jobs which were all running smoothly. But since the beginning of this year pretty much all of them are having CronTrigger state as waiting. Some of them for more than ...
nSv23's user avatar
  • 554
0 votes
0 answers
84 views

InstallHandler Scheduled Apex not Running

I have an installHandler running post install to create a scheduled Apex job that runs a batch Apex operation to an AWS S3 bucket. I am able to run the batch operation and run the scheduler using the ...
bswartz's user avatar
  • 27
0 votes
2 answers
584 views

How to get ID returned from finish method of a batch to LWC?

I have built LWC component to execute a batch job via apex controller. In the finish method, the batch is returning the id of a record inserted. I want to display that id on my LWC. How can I pass the ...
Developer SFDC's user avatar
-1 votes
1 answer
71 views

Schedulable single email apex class low coverage when deployed to production

I have a schedulable email apex class that sends email to sales rep with opportunities with awaiting approval as stage. This partial apex class below is 100% covered in production, however when I ...
Jayson's user avatar
  • 3
2 votes
1 answer
41 views

Test Class For Schedulable Apex Without Using (SellAllData=true)

Folks, I wonder if we have another way to create test class if we don't annotate with (SeeAllData=true). Here, my SOQL to retrieve a list of ContentDocument have been created more than 7 days. That ...
Pam's user avatar
  • 107
0 votes
2 answers
868 views

How to schedule the Apex class for every 90 minutes?

I have tried to execute my scheduler class from anonymous window to schedule it every 90 minutes but it is only scheduling for 1 hr. TokenScheduler testobj = new TokenScheduler(); String ...
Rene's user avatar
  • 3
-1 votes
1 answer
30 views

Apex Schedule Test Class Code Coverage

How Can I test the below class? public class SaleItem implements Schedulable { public void execute(SchedulableContext sc) { SaleProduct.pollSae('MT'); } }
user52619's user avatar
-1 votes
1 answer
278 views

How to parse a json having Rows and Columns

I have the below JSON and want to parse it out to get the data. But the JSON format is in Rows and Columns. { "returnValue":{ "columnNames":[ "RowID", ...
V T's user avatar
  • 507
0 votes
1 answer
552 views

Batch showing zero records processed ,is there a way to throw exception if no Records found in Querylocator

here is batch code which is executing currently showing as zero records processed in AysncApexJob , no errors though ,what i want is whenever batch find Zero record in SOQL of start method then batch ...
Fiona Gentry's user avatar
0 votes
1 answer
554 views

How to schedule a job twice a day with different minutes?

I have a batch that does three callout and then update some records, if occurs any error in the update or in the callout, a new record in the log object with the IDs of the records that occurred error ...
Alexia's user avatar
  • 83
1 vote
0 answers
160 views

AsyncApexJob.CronTriggerId present but no actual CronTrigger record

Maybe it has always been this way but ... If you execute System.abortJob(id), the AsyncApexJob.CronTriggerId still retains a value but there's no CronTrigger parent record Given the following code ... ...
cropredy's user avatar
  • 72.2k
0 votes
1 answer
627 views

How can I call a scheduled method in my LWC?

I want to call a method that I have created, that makes HTTP API callout to and fetches data. Apex method: @AuraEnabled(cacheable=true) public static String events (String webSite, String ...
Stojchesky's user avatar
0 votes
1 answer
588 views

Do Apex Schedules have Metadata?

I'm writing my first scheduled Apex for an internal organization. We do all of our development using sfdx and scratch orgs, merging into production using GitHub actions linked to the main branch. In ...
Chuck's user avatar
  • 977
-2 votes
1 answer
76 views

Can you please provide test class for this [duplicate]

global class LastLoginEmailJObs implements Schedulable { global void execute(SchedulableContext SC) { List<Messaging.SingleEmailMessage> mails = new List<Messaging....
user123449's user avatar
2 votes
1 answer
1k views

How can I make multiple Http callouts in a row?

I need to build an apex class that will perform multiple callouts in a row to an external system and upsert some records. Right now I'm sending a POST method with a query in the body and getting an ...
Leonardo dos Santos Zamboni's user avatar
-1 votes
1 answer
287 views

Multiple Web Callouts In Scheduled Apex

I'm trying to get some additional information on specific phone numbers in my database using web callouts. I won't hit the governor limits as it's going to be less than 100 numbers per day. I'm also ...
user121746's user avatar
-1 votes
2 answers
196 views

Can we add the debug statement without a method?

I am new to programming world and i have this Doubt public class new { integer h=10; system.debug(h); } this code is not working untill i create a Method and add this debug statement!!! is it ...
ASHWIN TIWARI's user avatar
0 votes
1 answer
191 views

Initially My Scheduler class was failing and when I add if(!Test.isRunningTest()) then its passing but its code coverage got dropped to 75%

here is the Apex class: global class GroupBatchSchedule implements Schedulable { global void execute(SchedulableContext sc) { GroupBatch b = new GroupBatch(); if(!Test....
user avatar
0 votes
1 answer
64 views

Merging two accounts if they have the same website,EIn and phone number

I am working on a batch class to merge two accounts if they have the same website,EIn and phone number. I did a code and tested with accounts having same EIN same phone number and same website and it ...
user121495's user avatar

1
2 3 4 5
19