Salesforce

tips

  • upsertの挙動について
    Updateが先に実行されその次にInsertが走ります。トリガー等で待ち構えていると2回呼ばれるので注意です。
  • 詳細にスケジュールを設定する
    // スケジュールを登録する
    PageSchedule batch = new PageSchedule();
    // 0時0分に1回実行
    String sch = '0 0 * * * ?';
    String scheduleId = System.schedule('スケジュール名', sch, batch);
  • Apex 承認プロセスの例
  • Sandboxと本番環境の判定
    Organization org = [select Id, IsSandbox from Organization limit 1];
    System.debug(‘—– org.IsSandbox : ‘+org.IsSandbox);

UserInfo