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
19 views

How can we call a java script button functionality from a scheduled batch apex?

I have a list view button which calls some javascript code on the click. Is there any way that we can call the same piece of javascript code from a scheduled batch apex? Scenario: Clicking on the ...
2
votes
1answer
22 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
67 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
33 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
24 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
33 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
31 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
31 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
44 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
55 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
19 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
32 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
23 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
22 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
247 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
28 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 ...
2
votes
2answers
93 views

Is system.schedule(…) @AuraEnabled?

I would like to know if system.scheduled is aura enabled or not. If not is there another methode that can replace it or a way to make it enabled? Edit final public class Plan { @AuraEnabled ...
1
vote
1answer
56 views

How to do this 'GET' through Batch?

I have a void callout class. But I need take all these tools through Batch to make it in Schedule later. How can I convert it into Batch structure with start, execute, finish? public static void ...
0
votes
2answers
38 views

unable to abort queued scheduled job

I have an apex job scheduled by mistake and now I cannot able to delete that. Due to that, I cannot able to edit my existing apex class. I tried the steps from Salesforce.com artice and when I execute ...
0
votes
0answers
58 views

How to make a Callout batch class?

I have a Callout with Lists and Maps. This takes objects from a resource and transfers them to my Lightning Component. How can I create Batch for this? I need Batch to schedule my callouts after every ...
0
votes
1answer
39 views

Schedulable error: You have uncommitted work pending. Please commit or rollback before calling out

I am trying to test Schedulable class which is designed to only run once. Because it's only runs once, I need to test that the System.abortJob is working correctly. I am using this code to test: ...
0
votes
1answer
43 views

Why my Batch is not updating the field

I am having one batch on Accounts which is not updating. I want to put the Sum of all the Normalized Accounts from all the invoices related to Accounts if the Status <> "invoice_canceled" and ...
1
vote
1answer
25 views

How to abort current scheduled job?

I would like to schedule a job to run once in 15 minutes time. According to this article: Run Scheduled Apex job once I need to add some code to the finish method: public void finish(Database....
0
votes
1answer
25 views

How many API calls can be made per hour to a non-bulk endpoint?

Assume that there was a REST endpoint that worked with 1 record at a time, i.e. not bulkified. If we were to use the Apex scheduler to pull down the records into SFDC every hour, what would be the ...
1
vote
1answer
40 views

Schedule Batch Apex too many rows

I am having an issue because I believe I don't understand batch apex/scheduling very well. Every time I use this I get either a SOQL error of trying to query too many rows of 50001, or a DML error ...
0
votes
1answer
34 views

Schedule class from the CronTrigger?

I have a requirement where I need give user an option to schedule a batch in a custom lightning configuration page. I can able to do it when we create a single schedule for a particular Batch by using ...
2
votes
1answer
154 views

System.StringException: Unexpected end of expression

Error: Line: 3, Column: 1 System.StringException: Unexpected end of expression. Class: public class OppSchedule implements schedulable{ public void execute(SchedulableContext sc){ ...
3
votes
1answer
66 views

How should I schedule multiple job of the same class?

I need to have a job that runs every 15 minutes. I checked out the documentation for Apex Scheduler and I came up with two solutions: 1-st: ScheduledJob job = new ScheduledJob(); System.schedule('...
0
votes
1answer
20 views

Can we run Scheduler class through another org?

I have a issue ,I have a source org and a target org ,i run a scheduler class from source org and it send data to taget org .Now i want to reschedule source org Scheduler class from target org . How ...
1
vote
1answer
44 views

How to find accidentally deleted scheduled apex job?

I cant find it anywhere even recycle bin, can someone help me how to find deleted scheduled job in salesforce?
0
votes
0answers
37 views

Schedule class doesnt work [duplicate]

Im having problems creating a schedule job in SalesForce. i have this class: global class dollarGetSC implements Schedulable { global void execute(SchedulableContext sc) { dollarGet....
4
votes
1answer
209 views

Enqueue Queueable class multiple times

I need to do five different callouts from my trigger. I'm planning to use one Queueable class for all the callout using the parameter passed in the constructor. I'm not sure if it is possible, if it ...
0
votes
0answers
17 views

Campaign Data from Salesforce to Eloqua

I am looking to send campaign data from Salesforce to Eloqua. I am just not sure what the best approach is or if there is anything built in that can help me do this. If not would the only way be to ...
2
votes
1answer
61 views

Get the actual Previous Fire Time of a CronTrigger / Scheduled Apex

I am exeuting Scheduled Apex that should do processing based on the last execution time of the particular code. I query some records for processing and I only want to query those records, that have ...
0
votes
1answer
19 views

how to get details of deleted scheduled apex job. need exact cron query

we had a an old scheduled apex job running every 7 hours setup by a consultant. we deleted the job. we know the apex class that it used to call but we do not currently know the exact cron query or job ...
2
votes
1answer
98 views

Validation rule Scheduled Apex

I have a scheduled apex job which updates a field which is controlled by a validation rule as follows: AND( Not(ISNEW()), $Profile.Name != "System Administrator", ISCHANGED(...
1
vote
0answers
89 views

How to bulk query ContentDocumentLink for Scheduled Job

I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and ...
5
votes
2answers
83 views

How to disable asynchronous jobs so that they cannot update data

There will be a data export happening from our org for large number of objects and records using a cloud based ETL tool. We have a business scenario where we need to make sure that there is no data ...
0
votes
1answer
159 views

How to See Scheduled Job Run History

I have a scheduled job that is supposed to run every night at midnight. Recently users have said that the job didn't run; however this is sporadic, some nights it works and others it doesn't. Is ...
1
vote
1answer
46 views

How to manage versions of scheduled flows?

We have an autolaunched flow that we would like to run on a schedule. I have created an apex class to do so, but when testing the class, I discovered that it is encountering errors only associated ...
0
votes
1answer
119 views

Schedule a Queueable class

i am quite new to salesforce so i am not sure about this, and i wanted to get a clear answer since i haven't found one yet. Can i schedule a Queueable class that basically makes a callout to get and ...
1
vote
3answers
140 views

Need help-apex cpu time limit exceeded

I scheduled an apex job to run daily at midnight but noticed that the job failed due to the Apex CPU time limit exceeded error. The code works in my developer sandbox but not in production. I'm ...
1
vote
1answer
152 views

How to get CronTrigger ID of Scheduled Apex job when starting the Scheduler

I recently created a scheduled Apex job in a sandbox, then later tried to abort it and was unable to because I didn't have the CronTrigger ID and couldn't find it. I found several questions on ...
0
votes
1answer
20 views

Create a task if a particular if a date lapses? Scheduled APEX the only option?

I feel like I may be missing something obvious here, but I have a certain field that is populated with a future date. I would like to ensure that follow-up tasks are created when that due date lapses, ...
0
votes
1answer
17 views

Who is the sender for a SimpleEmailMessage sent inside an scheduled apex class?

If I have a scheduled job that periodically runs and queries a custom object, then creates a simpleEmailMessage and uses Messaging.sendEmail(), who will the sender for that email be? The user who ...
0
votes
0answers
183 views

Create Excel XLS from batch apex via Visualforce page

I have a scheduled batch apex that currently creates a .CSV document and attaches it to an email, but I have to change it, so instead of a .CSV file, I get a formatted XLS Excel document. Now, after ...
0
votes
0answers
12 views

Apex scheduler failing to execute scheduled job [duplicate]

I have an Apex Class an example below. global class EmailChasing implements Schedulable { global static void execute(SchedulableContext SC) { chaseEmail(); } public void chaseEmail(){} } Error ...
0
votes
1answer
46 views

Test classes for Scheduled Apex classes [duplicate]

Below I have shared the APEX code and the Test class code. I receive 100% code coverage, but I cannot grasp certain parts of it. Eg. The system.assert function - is it necessary? How do I know my test ...
0
votes
1answer
61 views

Batch and Schedulable Help

I'm trying to create a batch class that updates a set of number fields based on a particular profile that edits them and a schedule class that updates those changes every night at midnight. So far ...