- Limits クラス
- トランザクションの制御 Database.rollback(sp);
- Visualforce ページの postback 要求の実行順序
- transientのリストから取得したレコードについて
- バッチクラスでHTTPコールアウトを作成する方法
global class BatchSync implements Database.Batchable<sObject>, Database.AllowsCallouts {
- REST Webサービスを公開しており、双方向SSLを確立(SalesforceおよびREST Webサービス) HTTP 要求での証明書の使用
- VisualforceからSOAPまたはREST Webサービスへの非同期コールアウト
↓
public class AsyncExecutionExample implements Queueable {
public void execute(QueueableContext context) {
Account a = new Account(Name='Acme',Phone='(415) 555-1212');
insert a;
}
System.enqueueJob(new SecondJob());
}
TestClass
@isTest
public class AsyncExecutionExampleTest {
static testmethod void test1() {
// startTest/stopTest block to force async processes
// to run in the test.
Test.startTest();
System.enqueueJob(new AsyncExecutionExample());
Test.stopTest();
// Validate that the job has run
// by verifying that the record was created.
// This query returns only the account created in test context by the
// Queueable class method.
Account acct = [SELECT Name,Phone FROM Account WHERE Name='Acme' LIMIT 1];
System.assertNotEquals(null, acct);
System.assertEquals('(415) 555-1212', acct.Phone);
}
}