0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Salesforce】豆知識

Last updated at Posted at 2020-08-24

豆知識

■バッチ関連

・バッチは1時間単位でスケジュールが可能

.一定時刻おきにバッチを起動したい場合

バッチのFinishメソッドでSystem.scheduleを利用して設定する。
/**

  • Finish
    */
    public void finish(Database.BatchableContext BC) {
    // 次回スケジュールバッチ登録判定
    if (this.isNextBatch) {
    // 次回スケジュールバッチ実行時間取得
    Datetime nextBatchTime = Datetime.now().addMinutes(5);
    // 次回スケジュールバッチ実行時間登録
    OpportunityChatterPostBatchSchedule cls = new OpportunityChatterPostBatchSchedule();
    String jobName = 'OpportunityChatterPostBatchScheduleJob_' + nextBatchTime.format('yyyyMMddHHmm');
    String sch = nextBatchTime.format('0 m H d M ? yyyy');
    System.schedule(jobName, sch, cls);
    }
    }

・任意時刻でバッチを起動したい場合

任意のClassでバッチをスケジュール、Excute AnonymousでそのClassを実行すれば、設定されます。
その後はFinish実行。
或いは、バッチをスケジュールするためのバッチを作る、例毎日0時のバッチで、次の24時間分のバッチを纏めてスケジュールする。

global class ExcuteScheduler {
public static void execute() {
String jobId_1 = System.schedule('【午前】9:00に開始','0 0 9 * * ?', new TestScheduler());
String jobId_2 = System.schedule('【午後】18:00に開始','0 0 18 * * ?', new TestScheduler());
}
}

■開発ツール

・開発コンソールで、メターデータ内にに含まれる文字列を検索

開発者→コンソール→Edit→Search in files

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?