Skip to main content

リストの作成

メモ

メモ

日本語で受講されている方へ
このバッジの Trailhead ハンズオン Challenge は英語以外の言語には対応していません。Trailhead Playground の [言語] を [English]、[地域] を [アメリカ合衆国] に切り替えてください。こちらの指示に従ってください。

Trail Together の動画

エキスパートの説明を見ながらこのステップを進めて行きたい場合は、Trail Together シリーズの一部である、こちらの動画をご覧ください。

(巻き戻して最初から見直したい場合、このクリップは 13:30 分から開始されます。)

リストを作成し、調整する

bankAccts というリストをインスタンス化して、2 つの BankAcct オブジェクトをこのリストに追加します。

  1. [Execute Annonymous (匿名実行)] ウィンドウを開きます。
  2. 既存のコードを次のコードに置き換えます。
    //From the BankAcct class, instantiate an object named chkAcct
    BankAcct chkAcct = new BankAcct();
    //Set the accttype attribute of the chkAcct object to Checking
    chkAcct.accttype = 'Checking';
    //Set the acctName attribute of the chkAcct object to D.Castillo-Chk
    chkAcct.acctName = 'D.Castillo-Chk ';
    //Invoke the makeDeposit method with 150 as the argument
    chkAcct.makeDeposit(150);
    //From the BankAcct class, instantiate an object named savAcct
    BankAcct savAcct = new BankAcct();
    //Set the accttype attribute of the savAcct object to Savings
    savAcct.accttype = 'Savings';
    //Set the acctName attribute of the savAcct object to D.Castillo-Sav
    savAcct.acctName = 'D.Castillo–Sav';
    //Invoke the makeDeposit method with 220 as the argument
    savAcct.makeDeposit(220);
    //From the List class, instantiate a BankAcct List object named bankAccts
    List<BankAcct> bankAccts = new List<BankAcct>();
    System.debug('The BankAcct List has ' + bankAccts.size() + ' bank accounts.');
    //Add the chkAcct object to the bankAccts list
    bankAccts.add(chkAcct);
    //Add the savAcct object to the bankAccts list
    bankAccts.add(savAcct);
    System.debug('The BankAcct List has ' + bankAccts.size() + ' bank accounts.');
    System.debug('Here is the list: ' + bankAccts);
  3. [Open Log (ログを開く)] が選択されていることを確認してから、[Execute (実行)] をクリックします。実行ログが開きます。
  4. [Debug Only (デバッグのみ)] を選択します。
  5. デバッグメッセージを確認し、ログを閉じます。

createContact メソッドで、Contact List (連絡先リスト) オブジェクトをインスタンス化し、candsFromTrigger という Candidate List (応募者リスト) オブジェクトを引数として受け入れます。 

  1. 開発者コンソールで、CreateContactFromCan クラスを開き、既存のコードを次のコードに置き換えます。
    public with sharing class CreateContactFromCan {
        //Declare a method that returns void and accepts a Candidate list named candsFromTrigger
        public void createContact (List<Candidate__c> candsFromTrigger){
        //Instantiate a Contact list named conList
        List<Contact> conList = new List<Contact>();
        }
    }
  2. CreateContactFromCan クラスを保存します。
無料で学習を続けましょう!
続けるにはアカウントにサインアップしてください。
サインアップすると次のような機能が利用できるようになります。
  • 各自のキャリア目標に合わせてパーソナライズされたおすすめが表示される
  • ハンズオン Challenge やテストでスキルを練習できる
  • 進捗状況を追跡して上司と共有できる
  • メンターやキャリアチャンスと繋がることができる