#salesforce
#trailhead
#salestraining
Quick Start: Apex Coding for Admins
Instantiate a list named bankAccts and add the two BankAcct objects to the list.
Open the Execute Anonymous window.
Replace the existing code with this code:
//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
ListBankAcct bankAccts = new ListBankAcct();
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);
Verify that Open Log is selected and then click Execute. The execution log opens.
Select Debug Only.
Review the debug messages and then close the log.
In the createContact method, instantiate a Contact List object and accept a Candidate List object named candsFromTrigger as the argument.
In the Developer Console, open the CreateContactFromCan class and replace the existing code with this code:
public with sharing class CreateContactFromCan {
//Declare a method that returns void and accepts a Candidate list named candsFromTrigger
public void createContact (ListCandidate__c candsFromTrigger){
//Instantiate a Contact list named conList
ListContactconList = new ListContact();
}
}
Save the CreateContactFromCan class.
00:00 Introduction
00:42 Apex Class
01:19 Code Verify
Watch video Create a List | Quick Start: Apex Coding for Admins online without registration, duration hours minute second in high quality. This video was added by user Saurabh Infotech Solutions 02 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 163 once and liked it 1 people.