Developer Fundamentals - PD1
11 September 2024
Understand multi-tenant concepts and design frameworks, such as MVC
architecture and Lightning Component Framework
● Lightning App Builder
○ Build lightning app pages, record pages, home pages, and email application
panes.
● Lightning App page
○ Standard, custom, third-party components can be added to the lightning
page.
○ Global actions can be added via the Actions attribute
■ Only possible for custom lightning page type
1
● Lightning Record pages
○ Object-specific actions are only supported on lightning record pages.
● Developing in Salesforcemulti-tenant environment
○ Polyglot persistence
○ The platform monitors queries and DML operations and throws a runtime
exception if they exceed governor limits.
■ This means: queries should be selective in terms of the number of
records returned.
● Execution Governors and Limits
○ Runtime engine enforces limits
■ How long a SOQL query can run
■ How many records can be returned in a query
■ The maximum amount of CPU time a transaction can take
■ Limits on the total number of DML statements that can be executed in
an apex transaction.
● Component Bundles
○ A component bundle contains a component or an app and all its related
resources.
2
○ Functions added in a helper file can be called from any JavaScript code in the
Lightning component bundle
● Aura component
○ Events are fired when an Aura component loads on a page
■ Init
● Signals that a component initialization is complete
■ Render
● Triggers the start of component rendering
■ afterRender
● Signals that the rendering is complete
● Domain
○ LWC
■ My domain must be configured and deployed to the org in order to
use custom Lightning components.
■ Lightning components do not need to be activated after being
deployed to the org.
■ Lightning components are defined as public by default.
● Communicating with Events
○ Lightning framework uses event-driven programming
■ Application events allow all components on a page, regardless of the
containing component, to respond to an event
■ Component events
3
● can only be handled by components in the firing components
containment hierarchy
Given a scenario. Determine, create, and access the appropriate data
model including objects, fields, relationships, and external IDs.
● Access sharing programmatically
○ Objects on the detail side of a master-detail relationship do not have an
associated sharing object, and access to the detail records is determined by
the master object sharing object and the sharing setting of the relationship.
○ Standard object: suffix “Share” is added
○ Custom object: suffix “__Share” is added
● Salesforce AppExchange
○ Marketplace for downloading solutions such as apps and components for the
salesforce platform. (Free and Paid solutions)
■ May include support and maintenance
■ Platform is used for installing an already built solution instead of
additional development tools for building solution.
■ It is not used for scanning security vulnerabilities.
● Apex Describe Information
○ getGlobalDescribe():
■ Return a map of all sObject names(keys) to sObject tokens(values) of
the standard and custom objects in an org,
○ desceibeSObjects()
■ Obtain metadata, such as the object properties and field list. Of a
single sObject or multiple objects.
● Determinetypes of permission on the current object
○ DescribeSObjectResultclass
● Field accessibility with apex
○ DescribeFieldResultClass
■ Contains methods for describing sObject fields
4
■ isAccessible() method
● can be used to determine if the current user has read access to
a specific field
■ getDigits() method
● returns the maximum number of digits specified for the field.
● Only valid with integer fields
■ isFormulaTreatNullNumberAsZero()
● Returns true if null is treated as zero in a formula field
○ DescribeSObjectResultClass
■ Contains methods for describing SObjects.
■ getSObjectType()
● Returns the SObjectType object for the sObject
■ getRecordTypeInfosById()
● Returns a map of the record Ids and details of their associated
record types
● Result Data Type is:Map<Id, Schema.RecordTypeInfo>
■ getRecordTypeInfosByDeveloperName()
● Return a map that matches developer names to their
associated record type
■ getRecordTypeInfosByName()
● Return a map that matches record labels to their associated
record type
■ getLabel()
● Returns the objects label, which may or may not match the
object the object name
■ Determine types of permission on the current object
● isDeletable()
● isAccessible()
● isCreateable()
5
● isSearchable()
○ SchemaClass
■ Contains methods for obtaining schema describe information
■ describeTabs()
● Returns information about the standard and custom apps
available to the running user.
● The result can be stored in a list of
Schema.DescribeTabSetResult.
■ getPicklistValues()
● the getPicklist Values method is used to retrieve the picklist
values.
● A Schema.PicklistEntry object is returned from the field
describe result using the getPicklistValues method
● Compound Field Considerations and Limitations
○ Compound fields are read-only. To update field values, modify the individual
field components.
6
○ Compound fields are accessible only through SOAP API, REST API, and Apex.
The compound versions of fields aren’t accessible anywhere in the Salesforce
user interface.
○ Although compound fields can be queried with the Location and Address
Apex classes, they’re editable only as components of the actual field. Read
and set geolocation field components by appending “__latitude__s” or
“__longitude__s” to the field name, instead of the usual “__c.”
○ Geolocation and Address
● External Object Relationships
● RecordTypeInfoclass
○ getDeveloperName()
■ Return the developer name of a particular record type
○ getName()
■ Returns the UI label of a record type
● Publish Event Messages with Salesforce APIs
○ RESR API can be used to publish platform event messages
○ Flow, process, apex trigger can be used to subscribe to the plat event
■ When an event message is received, it can send an email to the users
and create a record of a custom object automatically
■ Flow is an automation tool in salesforce that cannot be used to
publish event messages from an external application
● Check Formula field
● Object Relationship
○ Lookup and master-detail relationships are not available on the User object
■ User object can only be linked with itself
7
● Possible by using a hierarchical relationship
○ Master-detail
■ Creating a master-detail relationship field on the detail (Child)
object
● master-detail relationship on Account
○ Account is the child object.
● Master-detail relationship to Object B
○ Object B is the parent object
■ In standard and custom objects
● The standard object is always the master
● Detail records will inherit the security and sharing settings of
the master
■ Child records in master-detail relationships on custom objects can be
reparented to different parent records by selecting the ‘Allow
Reparenting’ option in the master-detail relationship definition
■ Custom objects on the detail side of a master-detail relationship
cannot have queues since they require the Owner field.
● This field is automatically set to the owner of the master
record.
● The child record inherits the record owner of the parent record
○ Many-to-Many
■ Junction custom object is required
8
○ Lookup
■ The child record can have a different owner
■ Do not need to be marked as required on the page layout
■ Roll-up summary fields can only be added to the parent object in a
master-detail relationship
■ Lookup relationships do not support creating roll-up summary fields
■ Link a child standard, custom, or external object to a parent standard
or custom object
■ Objects in lookup relationships are loosely coupled, and have
independent sharting settings.
○ External lookup
■ Links a child stand, custom, or external object to a parent external
object
○ Indirect lookup
■ Link a child external record to a parent standard or custom object.
■ When an indirect lookup relationship field is created on an external
object
● The parent object field and the child object field are specified
to match and associate records in the relationship
○ Specifically, a custom, unique, external ID field is
specified on the parent object to match against the
child’s indirect lookup relationship field, whose values
come from an external data source
○ Hierarchical
● External Id
9
○ External Id field can be used to associate records instead of the usual record
Id
○ When relating records using this approach
■ The child object must have an existing relationship field to the parent
object such as
● Lookup or master-detail relationship
● Data Types
○ Change data types of custom fields
■ File field type cannot be converted into other data types
■ Option to change the data type of a custom field is not available for all
data types
■ Data type of fields that are referenced by the Apex class/Visualforce
page cannot be changed easily
● References should be rectified first
■ Data type change can result in data lost.
○ Delete fields: Custom fields are referenced by certaincomponents in
Salesforce, they cannot be deleted
■ Components include:
● Apex class
● Apex trigger
● Visualforce page
● Visualforce component
● Workflow rule
10
● Field update
● Criteria-based sharing rule
● Flow
● Jobs
● Formula
● Schema builder
○ Objects and relationships can be defined
○ Custom objects can be created and deleted
Given a scenario, identify common use case and best practices for
declarative vs programmatic customizations, including governor limits,
formula fields, and roll-up summaries
● Roll-Up Summary Field
○ A roll-up summary field calculates values from related records, such as those
in a related list. You can create a roll-up summary field to display a value in a
master record based on the values of fields in a detail record. The detail
record must be related to the master through a master-detail relationship.
○ When multiple currencies used, the currency of the master record
determines the currency of the roll-up summary field.
○ A roll-up summary field can calculate the value of formula fieldsunless
■ The formula field contain cross-object field references
■ The formula field contains functions that derive values dynamically,
such as
11
● NOW or TODAY
○ Roll-up summary field can be created on any object on the master side of a
master-detail relationship
■ Caserecords are related to Accounts and Contactsvia lookup
relationships
● Thye can not be used in roll-up summary fields on those 2
objects.
○ Formulas:
■ COUNT
● Totals the number of related records.
■ SUM
● Totals the values in the field you select in the Field to
Aggregate option. Only number, currency, and percent fields
are available.
■ MIN
● Displays the lowest value of the field you select in the Field to
Aggregate option for all directly related records. Only number,
currency, percent, date, and date/time fields are available.
■ MAX
● Displays the highest value of the field you select in the Field to
Aggregate option for all directly related records. Only number,
currency, percent, date, and date/time fields are available.
● Dynamic forms
○ Can be enabled on a lightning record page
12
■ Fields from the current record as well as fields from parent objects
can be added to the page.
■
● Formula function
○ CURRENCYRATEformula function can be used in a formulafield to return the
conversion rate to the corporate currency for the given currency ISO code.
● Formula fields
○ Can return an image by using the IMAGE function
○ Return a link with the session Id as a parameter by using the HYPERLINK and
GERSESSIONID function
○ Limitations:
■ DO NOT support Long/Rich/Encrypted Text Area fields
■ Not available in
● Connect Offline
● Web-to-Lead forms
● Web-to-Case forms
● Cross-object formula
○ Reference field values from related parent records
○ Even though a user does not have access to a record, data from this record
can still be visible to the user through cross-object formula fields.
○ Formula fields can reference field values from related parent objects that are
up to 10 relationships away
○ Formula fields can not reference values from child records.
13
Given a scenario, identify the options and considerations when
importing and exporting data into development environments.
● Data import
○ Types:
■ Basic Data Import
● A guided process for importing contacts and leads using CSV
file and a simple data-mapping interface
■ Data Inport Wizard
● Large or complex import job / to import data for other objects
● Up to 50,000 records at a time
● ‘One-time’
■ Data Loader
● Large or complex import job / to import data for other objects
● More then 50,000 records
○ Difference:
■ Data Loader can load higher data volumes than the Data Import
Wizard, While both tool support custom objects, he Data Import
Wizard does not support all standard objects, unlike Data Loader.
Mapping cannot be saved using the Data Import Wizard, which makes
Data Load suitable for loading data multiple times.
■ Data Import Wizard provides an option to prevent workflow rules and
processes(as well as record-triggered flows) from firing when records
are created or updated. The data storage capacity has no impact on
deciding which data import tool is used.
●
Describe the use cases and best practices for Lightning Web Component
events
14
● Events Fired During the Rendering Lifecycle
○ The firing of init() events starts from the innermost component and then
traverses outwards the components higher in the hierarchy.
15