Questions tagged [scheduled-apex]

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

Filter by
Sorted by
Tagged with
-1
votes
1answer
35 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
20 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
57 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
34 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
10 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
31 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
56 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
30 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
35 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
33 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
21 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
31 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
19 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
46 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
33 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
30 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
35 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
25 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 ...
-2
votes
1answer
36 views

Apex Job Error: can't parse argument number: org

can someone please help me with this issue can't parse argument number: org: This is the Batchable class: global with sharing class IMB_SendPushNotificationsBatchable implements Database.Batchable<...
0
votes
1answer
36 views

Next Scheduled Time gets null after execution of a scheduled Job. Asynchronous Apex

I was working with Scheduled apex and it seems quite simple that you define a cron expression and then simply schedule it and later on you can monitor the progress of your job under scheduled jobs and ...
1
vote
1answer
43 views

Get the scheduled Job name using Apex class name

I have seen many posts about finding out name of the apex class associated with a scheduled job. However, i have an opposite need. I am updating a scheduled class, that was scheduled to run at a ...
0
votes
1answer
18 views

Batch Apex Class is being weird

Here are the errors I am getting https://prnt.sc/ter539 I have no clue what I am doing wrong as I am following the documentation Salesforce is giving me for Batch Jobs... Here is my code. global class ...
0
votes
1answer
50 views

How to Schedule Run all apex tests on daily basis

How to Schedule Run all apex tests on a daily basis? Currently, we are performing it manually is there any way we can automate it?
0
votes
2answers
69 views

CRON Expression for specific time [closed]

How to schedule batch class to run at specific time 12.30 AM CST Daily. How to make it run at CST Timezone.
1
vote
1answer
37 views

Unit testing Schedulable that calls future method

This has been asked here and here, but I'm not satisfied with the answers. Hoping to gain a better understanding of this. In working through the Apex Specialist Superbadge, the callout portion of the ...
1
vote
1answer
18 views

How to identify what process updated all Profile records

All of my Profiles in Production show they were lastModified by a particular User, but I checked with him. He definitely did not do this. We have Managed Packages running. Could they have done this? ...
0
votes
0answers
36 views

Apex Class that runs queries and updates a custom object

I created an apex class that acts queries fields and updates a custom object but it is timing out when I try to execute it in the anonymous window. It is still in the sandbox but I don't want to ...
0
votes
0answers
44 views

How to get the class Name that created a scheduled job?

I have a list of scheduled jobs with me for which I want to find out the class Name associated to it. I was able to get the list of all the classes that uses the schedulable interface, but I want to ...
0
votes
1answer
34 views

Easiest way to schedule callout on failure

I have a class that places an order to an external API. This order sometimes takes a few minutes to complete. When the order is placed, I immediately get an Order Id in return, and the only way to see ...
0
votes
1answer
29 views

Scheduled Job trigger is 9 hours delayed

I have a set of records(around 90,000 records) to be updated at 1AM every day. But I cannot update at least 10,000 records in a bulk as salesforce reaches governor limits. Then I wrote a schedulable ...
0
votes
1answer
49 views

Scheduling apex batch jobs - what happens if frequency is too small for a large job?

I have a batch job that processes quite large amounts of data, in edge cases it can take up to 40 minutes to execute. I would like to have it run as often as possible. I have no way of estimating for ...
1
vote
1answer
53 views

Testing a Future Method that Schedules a Class - Test.stopTest() Does NOT Run Both Synchronously

I have a class with an @future callout method, and that future method schedules an instance of another class which also makes a callout. In effect, if the first callout is successful, it schedules ...
1
vote
0answers
34 views

scheduled Job to clear all objects in recycle bin

I want to have batch and schedualed job to clear all my recycle bin every night. I could write such job for on object, no problem. global class BatchDeleteRecycleBin implements Database.Batchable&...
0
votes
1answer
72 views

How's This for a Simple HTTP Callout Retry Framework?

Most of what I have read about retry operations is that they are vaguely complicated and indepth. I have written the code below which seems to accomplish this without too much confusion - I'm ...
0
votes
1answer
27 views

How to achieve 100% test coverage for the below code? --Schedule Apex and it's test class shown below [duplicate]

The schedule Apex code is shown below: global class DailyLeadProcessor implements Schedulable { global void execute(SchedulableContext ctx){ List<Lead> leadList = [Select id from ...
1
vote
1answer
47 views

Schedulable Apex - Test Class

I have created a schedulable apex that gets the leads that have been last modified for more than 3 days and perform an operation. But for my test class, i want to insert some test data... But the test ...
0
votes
1answer
168 views

Dynamically Scheduling Apex to Run at Various Points in Time

I see a lot of documentation on scheduling Apex to run repeatedly (i.e. every day at 1am), or even run once at a specific point in time, but I don't see anything about dynamically scheduling Apex to ...
0
votes
1answer
37 views

Too many soql queries in batch apex when only using 1 soql command

I'm getting the following error in batch apex even though I'm using only 1 soql command: Messaging.SendEmailError[getMessage=System.LimitException: LLC_BI:Too many SOQL queries: 201;getStatusCode=...
1
vote
2answers
75 views

Avoid Lock Row exception in Batch Processing

I have a Batch on Lead that is scheduled to run every 5 minutes. The criteria to pick the record in Batch is a field on lead ex. Flag = True. let's say very first-time batch runs and there are 50k ...
0
votes
0answers
44 views

Transfer Notes and Attachments from One Object to Another

need help figuring our my batch job that moves Notes and Attachments from one object(dsfs__DocuSign_Status__c), to its related Account, then delete the notes and attachments after they are moved. I ...
0
votes
1answer
26 views

Why Apex has much lower limit of simultaneously scheduled actions comparing to Process Builder?

From Apex DeveloperGuide: Apex Scheduler Docs: You can only have 100 scheduled Apex jobs at one time. You can evaluate your current count by viewing the Scheduled Jobs page in Salesforce and ...
0
votes
1answer
33 views

how to refer a record type in a apex class [duplicate]

I'm writing a Apex class to auto delete Case records of record type claims and service failure with created date older than 6 Years here is the code. But i'm failing to Refer the record type in the ...
0
votes
1answer
89 views

Batch class to update Contacts in Opportunities' Opportunity Contact Role

I have a requirement where I check for all Contacts related to Opportunities via Opportunity Contact Role junction object. For an Opportunity in particular stage, I update related contacts' with ...
0
votes
2answers
17 views

Incorrect signature for a SchedulableContext

I'm trying to create a daily export of a .csv report on Salesforce Apex. The problem is I can't test this code beacause I dont know what to put instead of "sc" when i try to excute it. Here is my ...
8
votes
2answers
880 views

What is the maximum length for a scheduled job name?

The question itself is relatively simple. If I call System.schedule(String jobName, String cronExpression, Object schedulableClass), what is the maximum length for a scheduled jobname parameter? ...
0
votes
0answers
28 views

I have a class that implements Schedulable that I need to also run from a Trigger

I have a class that implements Schedulable that I need to also run from a Trigger. Here is the process: On the Trigger before insert I'll update a field in the record under certain conditions. I have ...
2
votes
1answer
29 views

Scheduling a job

I have a class and another class that implements schedulable that calls the first class. I am pushing an update to production to the class. Do I need to unschedule the job then reschedule it? ...
1
vote
1answer
87 views

Apex Scheduler with CPU time limit problem

I have been reading about CPU time limit, but can't seem to find a solution to my scheduler. Can someone help me? How can I improve this? It works in Sandbox, but not in Production. Error message: ...
0
votes
1answer
34 views

Callout from batch issue

@RestResource(urlMapping='/UsageInputDemo/') global class APTS_UsageInputWSDemo{ @HttpPost global static void loadUsageInputsDemo() { RestRequest req =RestContext.request; Blob body = req....

1
2 3 4 5
16