Specific to problems with writing, running, or testing Apex code, where code execution is initiated by scheduled Apex feature. This always includes a class that implements the Schedulable interface.

learn more… | top users | synonyms (1)

0
votes
1answer
32 views

Deleteing multiple SObjects in batch apex

I have the following code that executes exactly how I need it to, the only issue is I receive "Apex CPU time limit exceeded" when I run the delete on Accounts, EmailMessage and update Cases. After ...
0
votes
1answer
31 views

Export and import data from one object to other within salesforce automatically

There are 2 objects in salesforce. object A and object B. Data (1000's of records) in object A is inserted by integration process(fetching from external system and inserting in salesforce object ...
0
votes
2answers
17 views

Schedule Apex in UI

I wrote a schedulable class: global class AccValidatorSchedule implements Schedulable { global void execute(SchedulableContext sc) { ... } } I executed the code in the execute ...
2
votes
1answer
36 views

Test class for Scheduled class not created records?

I'm having trouble figuring out why, when executing Test Class, which fires a Scheduled Class and the Batch Class within it, data I expect to be there, isn't. @isTest static void ...
2
votes
2answers
35 views

How to test schedulable job with future method?

I have daily job that makes callouts and updates some records. There is @future method invocation in execute() method. I have created test according to this guide: https://developer.salesforce.com/...
0
votes
1answer
30 views

Evoking an Apex batch class from a Time-Dependent Workflow Action

I am trying to call an apex batch class after a set period of time. I was thinking of using Time-Dependent Workflow Actions to achieve this, but how would I make the batch class call?
5
votes
0answers
55 views

Disadvantage To Using Batch?

This answer got me wondering, is there a disadvantage to using a Batchable for simple scheduled functionality, as opposed to executing the functionality purely via Schedulable? Its [sic] better to ...
0
votes
1answer
33 views

Salesforce queue email notification customize and auto trigger based on time

In my Salesforce Org, I got a custom object and queue. when a new custom object record created will assign to this queue by workflow. My question is how to accomplish following task: If this record ...
3
votes
1answer
43 views

How to call Controller Extension and its method within Schedule Class

I have the following apex class: public with sharing class AssignPermissionSet{ List<PermissionSetAssignment> p=new List<PermissionSetAssignment>(); private PermissionSet per; private ...
2
votes
2answers
88 views

How to Test Messaging.sendEmail

Looking for some help/advice in writing a test class. The class I need to test is an apex class to schedule a report that needs to be sent to an external email address once a month as a .csv ...
4
votes
1answer
45 views

Less resource expensive way to perform this scheduled task

I need to schedule anually a batch, on January 1st every year. This batch has to process all accounts to update a checkbox field. I'm trying to decide what is less expensive for the platform, so I can ...
0
votes
2answers
70 views

System.EmailException: SendEmail failed in test class

I have a scheduler class for which i have written test class,when running the test class i am getting System.EmailException: SendEmail failed. First exception on row 0; first error: ...
0
votes
0answers
33 views

Class produces same result everyday using SOQL Today() function

I have a class that implements Schedulable...pulls in a list of records created today, by using the TODAY() function. The data should change, and when the SOQL query is run manually, I do get ...
0
votes
0answers
31 views

send email alert to opportunity owner when opportunities closed date has passed

I want to send email alerts to opportunity owners when their opportunity close date passed. Let say if an opportunity owner have 4 opportunities with same close date so only one email alert should ...
0
votes
2answers
53 views

abort currently running job in Salesforce

Is there a way to abort currently running batch job in Salesforce? I tried to run the query below and all it did was remove all jobs from Scheduled Jobs section without stopping the one that is ...
0
votes
1answer
32 views

Scheduled Apex Class Testing Issue

I am trying to test a scheduled class in apex, but upon running the test method it gives me the following error: System.JSONException: Unexpected character ('0' (code 48)): was expecting double-...
1
vote
2answers
69 views

Batch Apex Query - when multiple batch jobs fails

Just a quick query on Batch Apex. Let us say I have about 8000 Opportunity records to process in our nightly batch job. The objective of this batch is to update a field on Opportunity if it matches ...
1
vote
1answer
19 views

Mass Email Alert to Salesforce Users

We have a requirement to alert the opportunity owner 90 days after the opportunity was created and meeting certain data criteria. We need to issue this alert on a daily basis for all matching ...
-1
votes
1answer
31 views

Cron Schedule Mondays 6AM

How can I schedule this batch class to run on every Monday at 6AM? public class BatchCount implements Database.Batchable<SObject> { public Database.QueryLocator start(Database....
15
votes
2answers
834 views

How to run Apex code every 5 minutes in 2016?

From a naive read of these questions and answers: 2012 - Are there best practices to get scheduled apex scheduled to run faster than once per hour? 2013 - What will be the cron expression for ...
3
votes
1answer
253 views

Need assistance on scheduled jobs

I have a scheduled job in my org which was scheduled 2 years ago without an end date. It runs every Friday at a specific time, which means it was scheduled using a cron expression. If I delete that ...
0
votes
1answer
54 views

Schedulable Batch Apex - Create Tasks

I'm looking to run a scheduled apex batch class that will create a task on any Contact record that had a sales rep assigned to them 1 day ago that hasn't been emailed yet. I've created 2 custom ...
1
vote
0answers
18 views

Can we send the follow up emails on the already send system email?

I have a requirement, as per which the system sends an email notification in each quarter to the Account contact for some document submission. Now, the system has to send a follow email after every 7 ...
5
votes
2answers
76 views

Scheduled Apex Class - Too many DML rows: 10001

I'm trying to schedule an apex class to run once every month to reset a number field on all Accounts to 0. global class updateMonthlyActivityCount Implements Schedulable{ public list<Account> ...
1
vote
1answer
43 views

Replicate Time Dependent / Scheduled Action Using Apex Code

I need to send an email to Contact(s) listed in my Opportunity Contact Roles, 24 hours after an Opportunity has been Closed/Lost, if the Opportunity hasn't been reopened in the meantime. So ...
0
votes
0answers
22 views

Batch is scheduled but cannot see any run logs in 'Apex Jobs'

I have a batch scheduled as can be seen in ‘Scheduled Jobs’ but somehow I am not able to see the logs in ‘Apex Jobs’ table. Therefore , I am not able to understand if the batch runs or not. I have ...
0
votes
1answer
37 views

How to schedule a job as specific user

In my requirement i have to send the custom report developed by us through email. So i have created apex scheduler class,email template and visualforce component. But when i schedule the job...there ...
0
votes
0answers
25 views

Apex Scheduler Help

I wish to write an apex class that runs 30 days after a status has been changed to Resolved this should change status field from Resolved to Closed. The reason for not using a workflow rule is ...
0
votes
1answer
31 views

Apex Class Scheduler for email template

I am turning to the forum for guidance and assistance. I have been trying to figure out a a means to schedule a email to fire to for a Contact on an Account that has not submitted their Monthly totals....
0
votes
0answers
20 views

Schedule Apex class code coverage at 0%

I have been working on this yesterday. I am still new to developing APEX code so go easy on me. I just need someone to point out where I am going wrong. I am attempting to create a trigger (new task ...
1
vote
1answer
54 views

How to send one email with multiple records in it

I wrote the schedule class for sending an email with lead records(It's going mail with each record) but we need to send one email(based on state) with multiple records created in lead(based on state). ...
2
votes
1answer
35 views

How To Change Apex Class into a Scheduable Apex Class

I am still a beginner and I trying to create a trigger that will create a task on a weekly basis (task once a week) until a field in the opportunity is label complete. This Trigger and Class work, as ...
4
votes
2answers
127 views

Testing scheduled apex: CronTrigger does NOT fire after Test.stopTest()

EDIT for clarification of title: CronTrigger is probably actually firing at some point in the testing process - what is wierd is that CronTrigger.TimesTriggered is NOT incrementing after Test....
0
votes
0answers
14 views

How to find Process builder modified scheduled actions

I have one Time based workflow for one custom object. When i change the schedule date, the time based workflow is showing updated scheduled date as showing in these pictures This is actual date: ...
1
vote
2answers
85 views

Passing an ID into execute method in Scheduled Class

Issue is under execute method, we have a sendMailDistribution(Ids) method, here am unable to get ID. It's giving an error like NullPointerException, am unable to rectify this. Can you please help me? ...
1
vote
0answers
33 views

Get the number of Opportunities for each User in the org (the count must include the records to which the User has atleast read access)

I need to get the count of Opportunity record for every User in the org where the User has atleast read access on the Opportunity record. I need to store the data obtained per User for every month in ...
1
vote
3answers
31 views

How to Re-Create Scheduled Jobs After Deleting Them

I need to make some changes to a schedulable class that inserts Case Share objects for our custom permissioning model. When trying to make changes to the class, the error is thrown that the class has ...
0
votes
1answer
40 views

Which Scheduled Job will run first?

I have two different Apex Jobs scheduled at 12:00 AM as shown below: Which job will run on next day? Will both jobs run one after another or only one job will run on next day? Both jobs refer to ...
0
votes
1answer
63 views

Cover Test Class with ContainsKey and KeySet Map Method

How do i cover containskey() and keyset() method? i only cover 68% of my code. here's my class here's my test class @isTest private class testCheckPickedLead{ static testMethod void myMassUpdate(...
0
votes
1answer
32 views

How Process builder schedule actions works

I have few schedule actions of Process Builder. The process is going to fire based on one Boolean record when that made true. I scheduled 100 days before expiry date. Now if i want change expiry date ...
2
votes
1answer
63 views

Batch Apex vs Regular Apex

We have a nightly job that will update opportunities for every record in a custom object. Since that custom object will contain only the "updates in the last 24 hrs", we do not expect the volume to ...
3
votes
1answer
37 views

Error in schedulable test class

Can any one help me out in writing the test class for the Schedualble class.I have written a test class but the system throws an error : Error: Compile Error: This schedulable class has jobs pending ...
2
votes
2answers
48 views

Possible to create a workflow to check field criteria after X time?

Requirements: I have a custom object with a boolean field that will always be set to false on creation. Within a given time interval, that field could be changed to true. When the time interval is up,...
0
votes
1answer
79 views

Query Activities on Lead

i need to query activities on lead. the idea is i want to get which lead has 10 activities with "unreach" subject and automatically change it to unqualified. i will use scheduled apex to daily check ...
1
vote
1answer
20 views

Execute queue in certain hours only

How can I modify this class to execute only within office hours? public with sharing class AddLeadQueue { public void AddLeadQueue() { System.debug('loaded'); } @future (callout ...
3
votes
1answer
55 views

Is there any way to schedule dashboard refresh at schedule time [duplicate]

I am trying to implement a process which can help me in refreshing the dashboard after one hour. I have tried using salesforce process builder but that too depends on having an activity.Please do ...
4
votes
3answers
165 views

Invalid field when using template, even though the field isn't set by me

I have an Apex class that runs every ten minutes and sends emails for some opportunities that were created in the system. Or at least, that is how it should work, but I'm getting an ...
2
votes
2answers
43 views

Email reminders per week

Please tell me the which aspect of salesforce should I use to implement this: I need to send reminder to the owner of a record as the end date of that record is nearing. I need to send one email per ...
2
votes
3answers
80 views

Both Apex Flex Queue and Scheduled Jobs used up

The system has batch call out APEX classes to sync Salesforce information with another Email sending provider, Active Campaign. Every time we insert or update a custom lead or custom opportunity, the ...
2
votes
1answer
43 views

testing future with callout from schedulable class

I'm definitely missing something. How do I test Schedulable class with a future method that does a callout?I have 100% code coverage of the Schedulable class but 0% of my service.The test fails as no ...