Questions tagged [scheduled-apex]

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

Filter by
Sorted by
Tagged with
7
votes
1answer
652 views

Deploy with Active Jobs - active job ignores deployed code on next scheduled run

I have an anonymous Apex scheduled job that runs every three hours on the hour: String cron = '0 00 07,10,13,16,19,22 * * ? 2015'; MyScheduledDispatcher sd = new MyScheduledDispatcher(); System....
0
votes
1answer
17 views

How to update a Scheduled apex class in Production?

Will I have to deactivate the scheduled apex class in test, make the changes and push it to prod ? Is it as simple as it sounds or is there a catch?
1
vote
0answers
22 views

Scheduled Apex with one-time execution not being executed

We have a number of Scheduled Jobs that are scheduled with repeat and these are all working fine. We have a handful of Scheduled Jobs that are dynamically scheduled and re-scheduled, either as one-...
0
votes
0answers
18 views

How to make a test class for a scheduled apex class? [duplicate]

I am new to salesforce and I have written test classes for only one class before which worked just fine. But how do I write one for a simple scheduled apex class. Here is the code below: global class ...
0
votes
1answer
570 views

I want send email alert to a public group every week with a html email template in apex class

but the time of setting template in my apex target object id is required and this block accept only 15 digit id so how can i retive ever member user id global class EmailSenderfriday implements ...
0
votes
0answers
8 views

Calling a managed class (in vlocity) in a batch class APEX

Is it possible to make a batch class then call a managed class from the vlocity? I'm trying to do this but I don't have an idea how to start it since I couldn't see the parameters needed for that ...
0
votes
1answer
22 views

Issue with the last 15 min of the hour when running a scheduler to be execute after 15 min

We have a Campaign which has a field that counting available sits. When a user is filling it personal data within a form, and submit the page, he redirects to a payment site (other system). I want to ...
2
votes
0answers
34 views

Scheduling a Managed Package Class from Anonymous window getting Invalid Type Error

I have a "SchedulableClass" class in a managed package. I want to schedule the class to run for every 5 mins in my org by Anonymous block, Below is the code System.schedule('Schedule Job ...
0
votes
0answers
16 views

Schdulable class doesnt send emails on product org while same code works in test org

Im testing the code in Anonymous Window with this code: NotificationNameOptions abc = new NotificationNameOptions(); abc.execute(null); On production org I get this error: Line: 12, Column: 1 System....
3
votes
1answer
1k views

How to find the information of the accidentally deleted scheduled job

Our business team has accidentally deleted a scheduled job in Salesforce. And we can't recall what is the detailed information. Is there any way we can find out the related information like which ...
0
votes
1answer
1k views

Apex job is already scheduled for execution

Hi I am getting apex batch already scheduled error while running test class. I don't know where i am going wrong. I am calling batch class from schedule class. Apex Class global class ...
0
votes
1answer
32 views

Test Class Coverage for Scheduled and Batch Classes

I am attempting to test a scheduled class that calls a batch class to update records. The following test class does not seem to find the Opportunity being created in the test class to pass that list ...
0
votes
0answers
15 views

Scheduling apex class through Processbuilder issue?

Hope all are doing good and safe. I have small issues with my class on scheduling through process builder.In my visualforce page I have a "apex:outputLink" by using this I'm executing some ...
0
votes
1answer
29 views

How to add 1 hour to record created date to run a Apex scheduler?

Hello All i am trying to run an Apex scheduler which i need to fire once if the DML fails in catch block. How to add 1 hour from the datetime where the exception is caught on the fly? catch(...
2
votes
1answer
2k views

apex batch to transfer and delete data

I am using a custom free app from app exchange to collect feedbacks from contacts about cases. The answers given by the contact are saved in a custom app object, but since the app has some limitations,...
1
vote
1answer
546 views

Validating a cron expression

I have a requirement where I accept a cron expression from the user and schedule a job with System.schedule. Before doing that, I need to check if there is an existing scheduled execution for that job ...
-1
votes
1answer
36 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,...
41
votes
4answers
20k views

Scheduled reports as attachment

Is there any workaround to send out scheduled reports as Excel attachment than actually embedding it within an email? Salesforce scheduled reports embeds the report in email making further drill down ...
0
votes
0answers
21 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
64 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
36 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
13 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
34 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
84 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 ...
1
vote
1answer
480 views

Schedule Class Error - DML statement found null SObject at position 0

I am getting an error DML statement found null SObject at position 0 in my scheduler class. I have pasted the code below.I am trying to insert Partner Lead object data in Accounts by a scheduler class....
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 ...
2
votes
1answer
42 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
36 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
22 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 ...
5
votes
1answer
427 views

question on crontrigger and possible state values

Whenever a scheduled Apex Job is submitted, an entry is made in the CronTrigger table. What I see is, when this job is completed successfully, I see the State changed to "DELETED". Based on the SOAP ...
0
votes
3answers
34 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
0answers
59 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 ...
0
votes
1answer
20 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
35 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
39 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
30 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 ...
1
vote
1answer
448 views

Change Email Language, Not Based On Running User's Language

I created a scheduled job which sends an email to System Administrator everyday. The scheduled job works in English and Japanese. I created a custom label and used translation workbench to translate ...
2
votes
0answers
98 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 ...
4
votes
1answer
2k views

How Long Does Salesforce Keep Apex Job Logs?

Does Salesforce delete Apex Job history after some interval of time (e.g. 1 week)? Or is it displayed in my org indefinitely?
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 ...
4
votes
1answer
2k views

Schedule Job does not execute

Since last Wednesday one of my schedules jobs (future calendar) does not execute but it schedules next time.I tried to remove and create again the job but was the same. If I execute the Batch manually ...
-2
votes
1answer
39 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<...
4
votes
1answer
401 views

possible to access REST API of another SF instance with portal user from scheduled class?

I have a scenario where I'd like a user of another SF instance to register in our portal, then have a scheduled class on their end reach out to a REST endpoint on our end. Upon reviewing the oAuth ...
0
votes
1answer
1k views

Edit properties of a Visualforce Email Template in apex so the email sent through Messaging.sendEmail() will have the most recent data in it

I have a visualforce email template that displays the list of Opportunity records that are populated using a visualforce component. I'm using this email template in a schedulable class. The HTML ...
0
votes
1answer
957 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
2answers
1k views

Not able to see the class scheduled by a schedulable apex

I was looking through the scheduled jobs in my org. I would like to know which apex class is scheduled through these jobs. Please let me know how i can find this information?
0
votes
1answer
609 views

Record is Deleted still it is displaying in Look-up Field?

I am running batch in the background where I am creating Master Accounts based on some criteria, however for testing purpose I deleted all Master Account records which were created from running the ...
0
votes
1answer
37 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
67 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 ...

1
2 3 4 5
16