Salesfo
Salesfo
Write an Apex class that sends a single email to a specified contact. The email should contain the subject
"Greetings from Salesforce" and the body "Welcome to Salesforce Apex Email Practice."
Write an Apex class that retrieves one document from Salesforce (e.g., an Attachment or ContentVersion
record) and sends it as an attachment in an email. The email should be sent to a specified contact with
the subject "Document Attached."
Write an Apex class that sends an email using a predefined email template. The template should be
based on the Contact object, and the method should send the email to a specific contact. Ensure that the
method uses the template ID and merges the fields from the Contact record.
Given a string employeeId a map of string to string employeeIdToEmail that contains employee IDs as
keys and the employee's email address as the value, return the email associated with the passed
employeeId. If the employee ID is not found, return '[email protected]'.
For example, if the map employeeIdToEmail contains the following keys and values:
c1
Name: 'Bryan McCartney'
Phone: '2143452398'
c2
Name: 'Janice Gonzalez'
Phone: '6923849837'
The method call phonebook(new List {c1, c2}) should return a map containing the following key/value
pairs:
Implement the method phoneToAccount that takes as input a list of Accounts, and returns a Map
containing the phone number as a key and the Account record as the value. Do not include accounts
without a phone number.
a1
Name: 'Acme Enterprises'
Phone: '2143452398'
a2
Name: 'Universal Containers'
Phone: '6923849837'
The method call phoneToAccount(new List {a1, a2}) should return a map containing the following
key/value pairs:
'2143452398' -> a1
'6923849837' -> a2
The method industrySummary takes as input a list of accounts with Industry and AnnualRevenue fields
populated. The method should sum up annual revenue by each industry and return a Map with each
industry as a key, and sum of annual revenue for that industry as the value.
a1
Name: 'Acme Enterprises'
Industry: 'Banking'
AnnualRevenue: 550,000
a2
Name: 'Universal Containers'
Industry: 'Retail'
AnnualRevenue: 200,000
a3
Name: 'SForce Capital'
Industry: 'Banking'
AnnualRevenue: 450,000
The method call industrySummary(new List {a1, a2, a3}) should return a map containing the following
key/value pairs:
The method casesByType takes as input a list of cases and returns a Map> with case types (Type field
on Case) as the keys, and a list of cases of that type as values. This map should not include cases with
no Type specified.
c1
Subject: 'Power does not come on'
Type: 'Electrical'
c2
Subject: 'Several switches not responding'
Type: 'Electrical'
c3
Subject: 'Lever jammed - cannot run machine'
Type: 'Structural'
The method call casesByType(new List {c1, c2, c3}) should return a map containing the following
key/value pairs:
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Inprogress
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Sumit
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Shubham D
Completed
Completed
Completed
Completed
Completed
Questions
Upon Account Creation if Industry is not null and having value as 'Media' then
populate Rating as Hot.
Upon Opportunity Creation if Amount is not null and is greater than 10000 then
populate 'Hot Opportunity' in description field.
When an Account inserts and CopyBillingToshipping (new field) checkbox is
checked then automatically copy account Billing address into account shipping
address.
Upon Creation of Position (Custom Object) if it is a new position and open
date(new field), Min Pay(new field), & Max Pay(new field), are not populated
then populated them with below values.
(a) Open Date = Today's date
(b) Min Pay = 10000
(c) Max Pay = 15000
Prevent account record from being edited if the record is created 7 days back.
Create two record types named as “Partner Case” and “Customer Case” on
Case Object. On creation of Case, as per the record type populate the total
number of Partner Case or Customer Case on Account object. Create Custom
Fields on Account to have total numbers.
When any Opportunity is created with amount populated or Opportunity Amount
is updated then populate total Amount on Account Level for all related
opportunities in Annual Revenue Field. If opportunity is deleted or undeleted
then update Amount on Account as well.
When the Employee record is inserted, updated, deleted and undeleted then
update ‘Present Employee Count’ on related Account.
Set OWD as Private for Account. Once an Account record is created, it should
be automatically shared with any one user who belongs to Standard User profile.
Naman Paresh Nadeem Gaurav
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Completed
Completed Inprogress
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Paresh Nadeem
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Completed NotStarted
Inprogress NotStarted
NotStarted NotStarted
NotStarted NotStarted
NotStarted NotStarted
NotStarted NotStarted
Inprogress NotStarted
Question
Fetch the child record from parent record (Contact is child and Account is
Parent) – Standard Objects
Fetch the child record from parent record (Student__c is child and Teacher__c
is Parent) – Custom Objects
Fetch the Parent record from child record (Contact is child and account is Parent ) - Standard obj
Fetch the Parent record from Child Record (Student__c is child and Teacher__c
is Parent) – Custom Object
Fetch the Account record which is group by Name and count the record
Fetch all Accounts, ordered by Name in ascending order and Industry not null.
Fetch all Accounts where the Industry is either 'Technology' or 'Finance'. (Without using OR opera
Fetch the Lead Record that are associate with each LeadSource that generated
more than 10 times
Create a multi-select picklist custom field named 'Skills' on the Account object, with the following
values:
a. Apex
b. LWC
c. Aura
d. VF Page
e. JavaScript
f. Rest API
1. Fetch all Accounts that must have Skills 'Apex', 'LWC', and 'Rest API'
2. Fetch all Accounts that must not have Skills 'VF Page', 'JavaScript', and 'Aura'
3. Fetch all Accounts that either have Skills 'LWC' and 'JavaScript' or 'Apex' and 'Rest API'
(without OR)
4. Fetch all Accounts that neither have Skills 'LWC' and 'JavaScript' nor 'Apex' and 'Rest API'
(without OR)
Sumit Naman Paresh Nadeem
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Completed
Create a batch class to update all account records ,if industry = agriculture then update
industry ='manufacturing' else if industry = 'manufacturing' then update industry = 'agriculture'
and then count number of records which are updated and which are failed and send the record
count via email to current user.
Create schedule class and schedule above batch daily 12 PM
Create a new account with new user with future method and in future method create a
queuable class in which Update the Account.Status__c field to 'Active' for all accounts that
were created more than a year ago.
Paresh Nadeem Gaurav