Foundations Apex API Developer Reference

fferpcore.ScheduledJobService

global with sharing class ScheduledJobService

A scheduled job service structure.

Methods

removeSchedules

global static void removeSchedules(Set<Id> existingJobs)

This method aborts the scheduled jobs specified by the Ids provided.

Input Parameters

Name Type Description
existingJobs Set<Id> A set of Ids associated with the scheduled jobs on the database.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<fferpcore.ScheduledJob__c> jobs = [SELECT Id FROM fferpcore.ScheduledJob__c];

Set<Id> ids = new Set<Id>{jobs[0],...};

fferpcore.ScheduledJobService.removeSchedules(ids);

runNow

global static void runNow(Set<Id> scheduledJobIds)

This method sets up a batch job and submits it for the specified scheduled jobs.

Input Parameters

Name Type Description
scheduledJobIds Set<Id> A set of Ids associated with the scheduled jobs on the database.

Exceptions Thrown

Value Description
Exceptions.ScheduleJobException Exception that is thrown if the method is called with a scheduled job that is not schedulable.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<fferpcore.ScheduledJob__c> jobs = [SELECT Id FROM fferpcore.ScheduledJob__c];

Set<Id> ids = new Set<Id>{jobs[0],...};

fferpcore.ScheduledJobService.runNow(ids);

setupSchedules

global static void setupSchedules(Set<Id> scheduledJobIds)

This method sets up scheduled jobs on the database using their Ids to specify which to schedule.

Input Parameters

Name Type Description
scheduledJobIds Set<Id> A set of Ids associated with the scheduled jobs on the database.

Exceptions Thrown

Value Description
Exceptions.ScheduleJobException Exception that is thrown if the method is called with a scheduled job that is not schedulable.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<fferpcore.ScheduledJob__c> jobs = [SELECT Id FROM fferpcore.ScheduledJob__c];

Set<Id> ids = new Set<Id>{jobs[0],...};

fferpcore.ScheduledJobService.setupSchedules(ids);
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.