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
15 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
22 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
34 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
16 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
729 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
25 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
23 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
43 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
33 views

Callout from batch issue

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

How to define a constructor and pass parameters to schedulable controller

I have a situation where I need to pass a string to schedulable controller from batch or any apex controller. I see that we can do it using public constructor in schedulable implementation. Please let ...
-1
votes
1answer
35 views

How to only on field history enable object in apex?

We have 5 objects. In these objects, we are only tracking 3 objects field history, How can I query on enable history objects How how to get only field history enabled object Name Please help me in ...
0
votes
1answer
47 views

How to iterate map inside a map

Hi I have a map which has a map inside a map as below Map<String,Map<String,String>> finaldataelementmap=New Map<String,Map<String,String>>(); Map<String,String> ...
3
votes
1answer
60 views

Impact of Freezing SF User - scheduled jobs, reports, oauth tokens

We are going to do one big release (deployment, configuration, data load) in our prod org and need to have some sort of maintenance window to prevent users from interacting with SF org. Freezing all ...
1
vote
1answer
34 views

Schedulable Apex Class to update fields in Lookup record

I have a Custom (Managed) object called Individual Email Result (et4ae5__IndividualEmailResult__c) which contains a Lookup field to a Contact record (et4ae5__Contact__c) and I want to create a ...
0
votes
0answers
12 views

queuing batch controller which has Outbound calls to get record details from external appilcation

I am requesting external application from SF on daily basis to get records and sync. I have 5-10 custom objects in our environment. I have to make API calls individually to get all those records and ...
0
votes
1answer
27 views

How do I test a schedulable email sending?

I have a schedulable apex class for the email sending. I tested a schedule, but I can't to coverage sending logic. Is there a some way to test good and bad scenarios for it? My class: public class ...
2
votes
1answer
32 views

Need advise on callouts and inserting/updating new records from external system

We have an external application where few records gets updated or created on daily basis. We already implemented inbound calls to salesforce but it is scheduled for once a month. We need to schedule a ...
0
votes
0answers
21 views

Scheduled Class within a Batch Class

I am trying to schedule a callout from a scheduled class. In order to get around the limitation of sending callouts from scheduled classes, I tried to include the scheduled class within my batch class,...
0
votes
1answer
15 views

How do I send an email based on a date difference?

For example, I have some DateTimeField__c, and if DateTimeField__c - NOW() = 11 (hours), I should send an email. Trigger is not a variant, because I can't check with it a formula field. A Scheduled ...
1
vote
0answers
74 views

Run a Autolaunched Flow created with the new (winter '20) schedule option

I have a flow as described in the title, created with this feature. If I click on the 'Run' button i receive the following error: The flow failed to start because the provided values were not valid: ...
0
votes
1answer
37 views

Salesforce Platform Event After Specific Interval

My Use Case - After Every 5 minutes i need to get a token from "X-System" and need to store in salesforce. To Achieve this we implemented batch and scheduler. What Batch and Scheduler Will DO are ...
6
votes
2answers
173 views

Current state of reliable execution scheduling

A number of approaches to more reliable scheduling and continuous processing have been used over time on the Salesforce platform, all of them suffering from serious drawbacks. These include: suicidal ...
-2
votes
2answers
101 views

How to call report in xlsx file format

could you please help me how to call report Xlsx file format, i am tried to below code, but i am not get the result: public class BatchUtilClass { @future(callout=true) public static void ...
0
votes
1answer
17 views

CPQ Generate Document Apex Jobs Queued Status

When clicking on "Generate Document" -> "Save" within a Quote record. The screen gets stuck loading. I did notice within Apex Jobs there is a lot of jobs Queued.
0
votes
1answer
89 views

I am not get the tabular report body in the attached email [closed]

I am not get the tabular report body in the attached email ,could you please help me. global class Exportertest implements Schedulable,Database.AllowsCallouts{ global void execute(...
0
votes
1answer
41 views

Upsert error with apex batch job

I have a custom object named AttendanceRate with 5 fields "AttendanceRate_' + weekDay + -'__c' for each day of the week. When a user creates an activity, he has 100% of attendanceRate for this day, ...
1
vote
0answers
16 views

Get the Schedules of Aborted Scheduled jobs

One of my team members has mistakenly aborted all the scheduled batch jobs from the system using the below code - List<CronTrigger> jobsToAbort = [select Id from CronTrigger where ...
0
votes
1answer
47 views

Code efficiency when using same content in multiple method in same class

what I should learn and do if I have 3 different methods that are essentially doing the same thing but only the query statement that makes the differences. For instance my code below have 2 methods ...
-2
votes
1answer
49 views

I am not able to scheduling the below code

When I am trying to schedule this below code: global class exportReport3 implements System.Schedulable { global void execute(SchedulableContext sc) { ApexPages.PageReference report = new ...
-1
votes
1answer
23 views

CRON Expressions every hour at specific times

Is it possible to run CRON job every hour at a specific time at that hour? I only ask because I want to spread out my scheduled batch classes throughout the hour to avoid maxing out the flex queue.
0
votes
1answer
38 views

calling two separate methods in an schedulable class based on time interval

I have One schedulable class that calls a method that have multiple if conditions to be executed FOR(Contact cont : contacts){ if(cont.Account....
1
vote
1answer
29 views

ApexLog's field DurationMilliseconds is giving large values for Schedule jobs

I was trying to debug a issue for scheduleable class, I found out that it is taking approx 65,00,00,000 milliseconds which is equal to approx 180 hours. But if I open that debug logs and see execution ...
1
vote
2answers
357 views

How many records can an Apex Batch process

Finding mixed results within web searches, trying to locate a concise answer as to how many records can a batch process. I am creating an apex batch that will run daily. It will query around 55,000 ...
0
votes
0answers
23 views

Test.setMock working in Scratch org but not in sandbox Org

We have batch class used to make an API callout and doing Opportunity upsert DML operation in the Start method. Based on the opportunity's return value, we are making another API callout and doing ...
2
votes
1answer
31 views

CronTrigger records already exist when running Apex test

I get the error message: Assertion Failed: Job already exist: Expected: 0, Actual: 3 When I run this test: @isTest public static void scheduleJob(){ // arrange // assert System....
2
votes
1answer
154 views

Add current stock price to account page

still pretty new salesforce developer, but I was curious what the best approach was to add a companies stock price to their account page in salesforce? I've been referring to the articles below: ...
0
votes
1answer
37 views

How to unit test the method that schedules an apex schedulable class

I have a method that executes the following code , I am not able to find any thing from CronTrigger to verify the scheduled job public static void ScheduleStatusChk(Id batchId, Set<Id> ...
1
vote
0answers
25 views

Scheduled import of leads

I have a requirement whereby leads are imported, but due to a process, they can only handle 5 leads every 10 minutes (inserting a lead triggers an inbound call to an agent). I have come up with the ...
0
votes
2answers
48 views

System.isScheduled() not working in Scheduler/Batch

I have a Scheduler class which executes a batch class. I also execute this batch class from a VF page. Deep down in the class hierarchy, I want to check if this batch was called from a Scheduler or a ...
0
votes
1answer
58 views

How to chain batch jobs when one is from a managed package

I have a scenario where users upload a file and a batch1 kicks off to create the records , once the records are created we pass on the ids we just created to another batch job (batch2) which is from a ...
0
votes
0answers
20 views

Schedule to the batch. By launching a single class (CRON creation) [duplicate]

I want to automation of the different steps by adding a schedule to the batch. By launching a single class (CRON creation). Setup the launch of the multiple phase throughout the time. Example: Phase ...
1
vote
2answers
114 views

Limit on Batch class

If I run a batch class every night, that goes over 10000 leads every night and updates a field. Would I get the limit exceeded error considering the huge number of records?
1
vote
1answer
50 views

I am trying to Schedule Class that will add a new contact under Account every 2 min

I am trying to Schedule Class that will add a new contact under All Account every 2 min and also there should be a validation check that you can not have more than 05 Contacts under a single Account. ...
4
votes
2answers
93 views

how to find out Schedulable class is already scheduled or not?

I have a apex class which implements Schedulable interface, I want to find out whether this class is already scheduled or not? Please help me with SOQL query to find out this.
0
votes
0answers
20 views

Time Trigger - Bulk process handling

I have a time based trigger (action on PB) which when met updates xyz field of account on last day of month. Suppose there were 300 records which initiated this time based Trigger on different ...
0
votes
1answer
74 views

Scheduling Flow

I am trying to create a screen flow that is scheduled in Salesforce. From the screen flow I call an Invocable method where I pass my input parameters from my screen flow. From there I call a future ...
0
votes
1answer
34 views

Schedule class runs instantly

I have a controller of an Apex Page from where I am calling a schedule apex class using system.schedule to run after one hour. From that schedule class, a batch class is being called to run which has ...
2
votes
1answer
23 views

Not Able to get fields from controller to Email Template when the mail is sent from scheulder

It would be great if I could get help with the below requirement that I have to achieve. The requirement is that I run a scheduler in a custom object called Project__c. Around 20+ projects pass the ...
2
votes
1answer
558 views

“Every 30 min” cron expression runs only hourly [duplicate]

I have a Lightning Component where users can choose how often an Apex Batch should be run. As options, I want to allow 30min, hourly and daily. Changing that should modify the CRON expression of a ...
2
votes
0answers
50 views

In a test class example of a Post Install script, sending an email and scheduling a class that performs an API callout

Scenario: In my example, as a part of the PostInstall (class implements InstallHandler) script I will be performing two actions; - sending an email to the installing User for the express purpose of ...

1
2 3 4 5
15