You are on page 1of 27
€ FOCUSONFORCE Developer Fundamentals Understand multi-tenant concepts and design frameworks, such as MVC architecture and Lightning Component Framework. De eeu eS eu cn cua (© rocusourorce 1 Table of Contents © Mucacchitecture @ snttnine component Eamework © Acomanaser (6 rocusoyrorce | After studying this topic, you should be able to: © Describe the features and how system resources are accessed and applications developed ina multi-tenant environment © ery ne comiseraton elated stem pitesina @) © dentity the citferent components of the MVC architecture and what they represent. 2 Describe the main features of the Lightning Component Framework. 7 i: © Describe the festures available or building applications using declarative and programmatic tools. (@ rocusovroRce s| Introduction compared otal deveopment Salesforce generally follows the Model-View-Controller (MVC) architecture where each layer presents specific aspects pertaining to application development. Solutions can be developed in the platform using several built-in declarative tools. For more complex requirements, programmatic tools are available such as Apex and Visualforce. The Lightning Component framework, which isa Ul framework, can be used for building custom Lightning components to deliver responsive and efficient event-driven applications. (@ rocusovrorce Salesforce Multi-Tenant Architecture The Salesforce multi-tenant environment consists of the following key elements and features: ‘SHARED RESOURCES ctoup comPuTine — Nal METADATA-DRIVEN = s KERNEL svsTeMUPDATES 5) (© FocusovroRce s| Cloud Computing The Lightning platform is a Platform as a Service (PaaS) that is built for cloud computing and based on the muttitenant architecture. | WEB-BASED PLATFORM Fr FOCUSED DEVELOPMENT Resources are accessed via the Internet using Underlying IT mechanisms do not need to be il abrowser. Ea managed. NO SOFTWARE INSTALLATION DEVELOPER CONSOLE ee | ee development. (IDE) may be used. @ FocusonroRce 6 Shared Resources ‘The multitenant architecture features shiared system resources and usage limitati All customers share the same computing power, custom-designed database, data storage, and core “ =a € Salesforce monitors code execution and has various governor and resource limits associated with code M. execution Resources such as CPU usage, queries, and records returned are limited per customer to ensure optimal performance. (@ roousovraRce 1 System Updates Multi-tenaney allows customers to receive reguilar upgrades throughout the year. =a PS) = SYSTEM UPDATES © ‘Automatic, seamless upgrades are rolled out three times a yea Winter. Spring, Summer, and aD “ SHARED ENVIRONMENT Fee] Alcustomers automaticaly et the same updates atthe same time throughout the ear ¢ RELEASE PREVIEW Sandboxes are uperaded before production so thatthe changes canbe previewed and tested ormivt 1 Metadata-Driven Kernel Salesforce uses a runtime engine that materializes all application data from metadata, which is data about the data itself. =" ARCHITECTURE Brigg Therets clear separation between he runt detabase engine (kernel tenant dat, and metadata, which allows easy upgrades. DEPLOYMENT (@ roousovrance ° Governor Limits Governor limits ensure tenants do not monopolize shared resources. If exceeded, these limits throw exceptions that cannot be handled and should always be taken into account when developing, SOQU/SOSL QUERIES Total number of SOQL or SOSL queries t EXECUTION/CPU TIME DMLSTATEMENTS. . Maximum CPU or execution time Total number of DML statements EB) Query RESULTS PROCESSED RECORDS . Total records retrieved from aquery Total records processed (DML, etc) . . EMAILSENDING cattouts @) + Total numberof sendEmal calls A e=an link in the Lear More section (@ rocusoyroRce +0] MVC Architecture (@ rocusoitaRce " MVC Architecture business logic and how the data is presented in the user interface. * VIEW i View represents the presentation layer which consists of pages and components. CONTROLLER bg} Controller represents the business los, ether declarative or programmatic. Custom controllers and controller extensions are written as Apex classes. (@ rocusovrorce In application development, the MVC is an architectural pattern that separates the data layer from the eo MODEL Model represents the structure of the data through sObjects fields, and Apex classes. =a MVC Architecture ‘The model layer of the MVC architecture includes the following components. MODEL @ Standard Objects © Custom Objects. © Object Fields © Object Relationships © Apex Classes (Data) (@ rocusovrorce MVC Architecture ‘The view layer of the MVC architectu OD (@ Standard Pages ludes the following components. © Visualforce Pages © Visualforce Components © Custom Tabs 1 Page Layouts (@ rocusoyroRce MVC Architecture The controller layer of the MVC architecture includes the following components. (<3 foie nny © Standard Controllers © Custom Controllers (Apex) (@ Extensions (Apex) © Declarative Rules & Tools (Apex Triggers, Validation Rules, Processes, etc) (@ rocusovronce Lightning Component Framework (@ FoousoiraRce Lightning Component Framework ‘The Lightning Component Framework is a Ul framework that allows building single-page web apps with dynamic and responsive user interfaces in Salesforce. It uses JavaScript on the client side and Apex on the server side. Some of its main features are as follows: TWOPROGRAMMING MODELS Lightning components can be built using the Aura Components or Lightning Web Components model. They can coexist and interoperate er =a ‘components for faster development, and enables customizing Lightning Experience and communities. (@ rocusovronce 2 Lightning Component Framework PERFORMANCE The framework utilizes a stateful client (using JavaScript) and a stateless server (Apex). The client calls the server only when absolutely necessa See ee tee eee pore 5] Event-Driven Architecture Lightning components utilize event-driven architecture. Components are capable of listening to events and responding accordingly. @ USAGE Lightning components can be used in many lfferent contexts. For ‘example, they can be added as custom tabs in Lightning Experience and the Salesforce mobile app. (© rocusovronce | MVC Architecture & Lightning Components The Lightning Component Framework is not strictly based on the MVC architecture, Aura and Lohr ea web components follow the MVCC (Model-View-Controller-Controller) pattern. VIEW MODEL eB ‘View represents the Light ‘component. It. HEED scl epresensthe database Objects, Ce has the emp suffix and contains markup. The fel and Apexclase) markup contains text andor referencesto ther component CONTROLLER (CLIENT-SIDE) CONTROLLER (SERVER-SIDE) The JavaScript controleron the cent ses The Apexcontrole onthe server sides BOM tcotopeermcien sie operation and. | PROM isda pero datbnse operations The alsoactsasthelntermedary beeen the Javascript controler suse ocallmethods Server andthe UL inthe Apex contrat, vex Ea MVC Architecture & Lightning Components ‘The Lightning Component Framework is not strictly based on the MVC architecture. Aura and Lightning web components follow the MVCC (Model-View-Controller-Controller) pattern, &, peo} Controller Corie User Interface JavaScript Controller Apex Controller Database EE (@ rocusovronce | Custom Lightning Components Custom Lightning components can be built using the Lightning Component framework which includes a set of prebullt self-contained and reusable components, © BASE COMPONENTS ‘The framework provides several out-of-the-box components which ‘come with the Lightning Design System styling. These components can be found inthe ‘lightning’ namespace and are available in two versions: ‘Aura components and Lightning web components. Note that Aura ‘components in the ‘ui namespace are deprecated and will nolonger be supported. REUSABLE COMPONENTS, Components that are built using the framework are self-contained and ‘reusable units that can range in granularity from a single line text to an entire app. Components can be assembled and configured to form new ‘components, (@ rocusovrorce 2s Custom Lightning Components © SOPHISTICATED UIS ‘Acomponent can contain HTML, JavaScript, CSS, any Web-enabled ‘code, and also other components, which allows developers to build apps with sophisticated Uls. COMPONENT FILES/RESOURCES ‘An Aura component or app can contain various resources which are part o ‘of a component bundle. The markup (a cmp or app file) sits only required resource, Other resources can be a controller, helper, CSS styles, design, documentation, renderer, and SVG ile. A Lightning web component, on the other hand, follow web standards and typically contain an HTML, JavaScript, CSS, and configuration (XML) file, (@ rocusovronce 2 Prstam Lnhtning Camnanante —_ wuscum nage 5 Vuipones © COMPONENT EVENTS ‘Aura components support two types of events, namely component ‘events and application events. Component events are used for handling events in the containment hierarchy while application events allow handling events at the application-level. Lightning web components can communicate across elements ona page using a publish-subscrlbe pattern where one component publishes the event and subscribing components receive the event. @ LIGHTNING DATA SERVICE ‘The Aura framework supports the Lightning Data Service (LDS),which serves asthe data layer and can be used to read, create, update, and delete records (© rocusonrorce a (© rocusonrorce 2 Building Apps in Salesforce ‘An app is a group of tabs that work as a unit. In Salesforce, Classic and Lightning apps can be created and customized to serve specific functions in Salesforce. © APPCONTENTS o Classic apps contain standard and custom tabs, which can include standard and custom object tabs, Visualforce tabs, Lightning component 6 ‘abs, Canvas apps, and web tabs. On the other hand, Lightning apps contain everything from the Classic apps lst, plus they can contain Lightning Page tabs and utilities ike Sales Dialer. a0 CREATING APPS . {Lightning app can be created by navigating to App Manager in Setup, (Once an appis created, it can be extended by adding objects and fields, Using automation, defining access settings, adding users, et. Lightning ‘App Builder can be used to update the app branding, navigation, and ‘ther options, and manage the Lightning pages assigned to the app. (© rocusovroRce 2s| Building Apps in Salesforce NEWLIGHTNING APP WIZARD ‘When creating anew Lightning ap sing the App Manger, the app ca be given a name, its primary color and logo can be set, app description! * - ‘canbe added, and the type of navigation (standard or console) canbe set. Form factors available for the app can be selected, The items that appear inthe navigation bar can be selected. Utility items, ike Recent Items, Notes, Dialer To do list, and Open CTI, can be added to the utility bar. y The app can be assigned to user profiles. @ NAVIGATION BAR ‘The item at the top of the list in the navigation bar becomes the app's landing page on both desktop and mobile. The order of the items determines the default objects shown in the Top Results page on the search results page. (@ rocusovronce 2s App Manager A Lightning App can be created using the Lightning Exps ence App Manager in Setup. Lightning Experience App Manager New uprningagp | New comets pp 27 monet by App one: rayon Tobe pe sypmame tv Bemtopername —_eseion Y tameanes.. v tep ww 1 sna stue rites iden Antes denboursa...2/192000 8849 Cenic vy 2 Amp tauerar seninnene op Lancer ite aisfammeserm come Vw 2 soution Larnngsok cover and manage bisiesseht. 3/19/3030,855°M Upnnng Yow 6 UetingSchmder Setup LihnnScheder Setup penondanpoininench.. 2/19/2020, 055° Ushing Vw (© rocusoronce a App Manager When creating a new Lightning App, the App Name and Developer Name are required, Other details ‘such as its description and branding can also be specified. Nenana 60 ‘App Deas ann == a P| (@ rocusovronce App Manager In the App Options configuration page, the navigation style and form factors that the app will support are specified. Other options are related to setup and personalization settings. New annie pe . ° @ FocusonroRce » App Manager The navigation style determines the personalization settings available for the app. =a New Lightning App App Options Navigation and Fem Factor © aan oe ‘Sun navastin septate. ceo [© coat roonton Seve Sohn *soparad armas Ton Paces ings 2 Deon oon hale end ne: psa ene ‘rowan so en om (@ rocusovrorce Ea App Manager Utility items can be added to a utility bar, which is a feature that is only available to desktop devices. (@ rocusovronce ” App Manager The items that are added to the Selected Items column will appear in the navigation bar of the Lightning App. New Ustting Ae Navigation Items (@ rocusovrorce x App Manager ‘The Navigation Rules option, which is only available when using the Console navigation style, determines whether records are opened as a workspace tab or subtab of another record. as 5) teen — Ee Deru eo = ————T =o @ FocusonFoRCE x App Manager =] Pronies are assigned to the Lightning App by aaaing them to the Selectea Promiies column. Unly users assigned to these profiles will be able to access the Lightning App. (© rocusovroRce Lightning App Builder _ = (@ roousoiraRce Lightning App Builder Lightning App Builder is a declarative tool that can be utilized to create and configure custom pages for Lightning Experience and the Salesforce mobile app. © CAPABILITIES Lightning App Builder allows building and customizing sinele-page apps, dashboard-style apps, ‘point’ apps that solve a particular task, custom Or ee — Fe LIGHTNING PAGES ‘The following types of Lightning pages can be created using Lightning, ‘App Builder: app page, home page, record page, and email application y pane. When creating a Lightning page, a template can be selected, which divides the page into regions. (@ rocusovroRce 26| Lightning App Builder © CREATING A LIGHTNING PAGE Todefine the content of a Lightning page, standard, custom and. third-party Lightning components from the AppExchange can be added tothe Lightning page. @ STANDARD LIGHTNING COMPONENTS, ‘Several standard Lightning components built by Salesforce are available {for creating Lightning pages. Some of them have required properties that ‘must be configured. Examples include Accordion, Chatter, Record Detail, Related Record, etc. \@ rocusovronce | Lightning App Builder 5] CUSTOM LIGHTNING COMPONENTS, Custom Lightning components can be built and added to a Lightning, page. However, to make a custom Lightning component usable in the Lightning App Builder and Lightning pages, the component and its ‘component bundle must be configured so that they are compatible. My Domain must also be deployed in the org. @ DYNAMIC LIGHTNING PAGES Itis possible to configure when a component appears on a Lightning page by adding filter conditions and logic to its properties inthe Lightning ‘App Builder. For example, a Lightning component can be set to display exclusively when its page is viewed on a phone. (© rocusoyroRce 20 Lightning App Builder Lightning App Builder can be used to build Lightning pages for apps using standard, custom, and third-party Lightning components. (@ rocusovronce (@ rocusoyroRce (@ rocusovronce Salesforce provides various declarative tools that can be used to build and extend apps, AUTOMATION Declarative Tools ‘The automation tools that are available for automating business processes declaratively are Process Builder, Flow Builder, Approval Process, and Workflow Rule, SHARING & SECURITY Features such as profiles, permission sets, and organization-wide defaults can be used to control sharing and security. BUSINESS LOGIC & VALIDATION Formula fields and roll-up summary fields can be used to calculate field values. Validation rules ean be used to enforce data quality Declarative Tools USER INTERFACE Various tools are available to build the user interface, such as App Manager, Lightning App Bullder, and Quick Actions. Data Import Wizard and Data Loader can be used to insert and update ‘multiple records, Data Loader can also be used to export and delete records. @ ANALYTICS ese can also be added to folders. (© FocusovroRce a Declarative Tools: Automation Declarative automation tools can be used to implement simple and complex business processes. PROCESS BUILDER Process Builder can be used to perform immediate or time-based actions when a record is created, a records Ea updated, or a platform event occurs. Itis useful when the ‘complexity of a business process consists of multiple if/then statements. (@ rocusovronce « Declarative Tools: Automation Process Builder can be used, for example, © vwenerrsantas Ej eesten en the following: process | wireversic € eee |} ceeireaciaerso | wrivezncnasien (@ rocusovroRce 4 Declarative Tools: Automation Declarative automation tos can be used to implement simple and complex business process FLOW BUILDER Flow Builder can be used to automate a guided visual ‘experience or starta business process from a user interaction, process, schedule, platform event, or record change. Flows can also be invoked from Apex and vice-versa, | rocussonce Declarative Tools: Automation Flows can be used, for example, in the following: © cosirerensecnss QE sass == === r Submitting a record for E oven QE € Updating any record E Crests chatter post EE] Govreneien — ene \@ roussironce “ Declarative automation tools can be used to implement simple and complex business processes. (@ rocusovrorce Declarative Tools: Automation APPROVAL PROCESS ‘An approval process can be used to submit a record for approval when a user clicks a button or link or when a flow or process submits a record for approval (@ roousovronce Declarative Tools: Automation ‘The main capabilities of Approval Process are as follows’ © owe Updating the original record Declarative Tools: Automation Declarative automation tools can be used to implement simple and complex business processes. (@ rocusovrorce WORKFLOW RULE ‘A workflovr rule can be used to implement a business process that consists ofa single if/then statement. Itcan be triggered when a record is created or updated, and supports both immediate and time-based actions. Declarative Tools: Automation ‘The main capabilities of Workflow Rules are as follows: @=s== Updating the original record ‘Sending an outbound message (@ rocusovtonce Declarative Tools: Sharing & Security Sharing and security features can be utilized to expose different data sets to different sets of users in Salesforce. © PROFILES & PERMISSION SETS Profiles and permission sets can be used to specify the objects and fields that users can access as well as user permissions that control what tasks users can perform and what features they can access. RECORD ACCESS ‘Access to records can be controlled by specifying organization-wide default sharing settings. Additional access to records can be provided Using features such as sharing rules, role hierarchy, manual sharing, and teams. (@ rocusoyroRce Declarative Tools: Business Logic & Validation Declarative features can be used to automate the calculation and validation of field values. FORMULA FIELDS. ‘A formula field can be used to automatically calculate the value of afield based on other fields. expressions, or values. A data type can be selected while building a formula field, The formula specifed in the field can contain references to the values of fields, operators, functions, literal values, or other formulas. Declarative Tools: Business Logic & Validation ROLL-UP SUMMARY FIELDS. Aroll-up summary field is used to automatically VALIDATION RULES caleulaterthevalueofafieldonaparent record | Wp Wh a validation rule can be used to verity thatthe (@ rocusovronce Es] field named Amount_c’ on child records can be Se Pisiarcanerealay ater enrarecied ees ta For example, the sum of the values of a custom PE aE a displayed on the parent record. (@ rocusovrorce | Declarative Tools: User Interface Declarative tools can be used to build user interface elements such as apps, pages, and actions, APP MANAGER ‘App Manager can be used to create an app which acts as the container for, a set of items such as object tabs and utility items. LIGHTNING APP BUILDER Lightning App Builder can be used for building and customizing single-page apps, dashboard-style apps, ‘point’ apps that solve a particular task, Ctstom record pages custom tome pats anus emallapston panes. QUICK ACTIONS: ‘Object-specific and global quick a Invoke custom functionality when using the UI. For example, they can use a quick action to quickly send an email toa customer. (@ rocusovrorce Declarative Tools: Data Management Data management tools can be used t iport data into Salesforce and export existing data DATA IMPORT WIZARD. Data Import Wizard supports import up to = paceee meee ae =a solutions, campaign members, and records of custom objects can be imported. DATA LOADER Data Loader supports import or export up to 5,000,000 records. One can insert, update, Upsert, delete, or export Salesforce records. (@ rocusovrorce ss| Declarative Tools: Analytics Reporting and analytics tools canbe used to build reports and dashboards that alow users to analyze data, REPORTS. Report Builder isa visual, drag-and-drop tool that can be used custom reports and edit existing reports It allows choosing a report type, report format, and the fields that should make up the report Declarative Tools: Analytics DASHBOARDS Dashboard Editor isa visual, drag-and-drop tool that can be used to build custom dashboards and edit existing ones. Dashboard components can be added, edited, or arranged ina dashboard. A dashboard component contains a chart or metric that shows data from a source report. REPORT AND DASHBOARD FOLDERS =a Report and dashboard folders can be used to organize and share reports and dashboards. (6 rocusoyroRce a Programmatic Tools Ss (@ rocusovrorce | Dennen atic Tanle Frugraunnaue rer ‘The programmatic features offered by Salesforce include Apex, Visualforce, and Lightning Components ‘which are used when a required functionality cannot be achieved using declarative tools. APEX ‘Apex cade can be used to build more complex business logic for apps. An invocable Apex method can be created and invoked as an Apex action in a process of flow. Apex triggers can be created to execute custom business logic before or after arecord is created, updated, deleted, merged, upserted or undeleted, Apex can be used for integration with external systems. It can also be used to perform server-side actions for custom Visualforce pages and Lightning components, (© rocusovrorce | Programmatic Tools =a VISUALFORCE Visualforce is a framework that can be used to bulld custom user interfaces, mainly for Salesforce Classic, It uses 2 tag-based markup language that consists of Visualforce tags, HTML, JavaScript, or any other Web-enabled code embedded within a single tag, Visualforce pages can be used to override standard buttons, define custom tabs, create dashboard components,etc. (@ rocusovrorce | Using Apex The following Apex class contains an invocable method which can be invoked from declarative tools such as Flow Builder or Process Builder. 11 An Apex class $4 allowed to have one (2) invocable method only public class CustonBusinessLogic ( tnvocabletethod public static void processtecounts() { 11 perform Loghe or process which # declarative tool 4s not capeble of achieving za (@ rocusoyroRce 7 Using Apex The invocable method can be invoked from Process Builder by specifying the name of the class in the ‘Apex Class field if the label attribute of the method is not defined. Toselect an invocable method, the Action. Types set to Apex. (© rocusovroRce Tools ‘The programmatic features offered by Salesforce include Apex, Visualforce, and Lightning Components which are used when a required functionality cannot be achieved using declarative tools. Programma‘ LIGHTNING AURA COMPONENTS Custom Lightning components can be created by using the original Aura Components model. Aura components are self-contained and reusable units of an app that represent ‘reusable sections of the Ul, and can range in granularity froma single line of text to an entire app. Various base components are available to build Aura components. (@ roousoyroRce LIGHTNING WEB COMPONENTS Lightning components can also be created using the Lightning Web Components (LWC) model, ‘which uses the core Web Components standards, HTML and modern JavaScript can be USING LIGHTNING COMPONENTS. Both Aura and Lightning web components can be used in places like custom tabs, Lightning ages, Experience Builder, Flows, Visualforce pages,ete. [ERE vsestobuidtichiningweb components. | | (© rocusoyroRce 4 Lightning Platform APIs (@ roousoiroRce ‘| Lightning Platform APIs Salesforce also offers a wide range of useful APIs that can be used in different scenarios. © RESTAPI REST API provides a way to programmatically access or process re services. Use this API when developing web or mobile applications that > need to integrate with Salesforce. @ SOAP API Similarly, SOAP API ets developers access, search, and perform DML. ‘operations on records from an external application via the SOAP messaging protocol, Use SOAP API in any languages that can work with, web services such as Java or C++. (6 rocusoyroRce ee Lightning Platform APIs @ CHATTER REST API =] Chatter REST API can be utilized to show Chatter related data such as. feed, users, or groups. Use this API when integrating Chatter with external web or mobile applications. v (@ roousovrance @ USER INTERFACE API User Interface API allows developers to build user interfaces that surface records, list views, quick actions, favorites, and other components. Use this API to build Salesforce Ul on external native mobile applications and web applications. @ ANALYTICS REST API Analytics REST API grants programmatic access to Salesforce Analytics data such as datasets, lenses, and dashboards. Use this API when there isaneed to access, query, and interact with the Analytics Platform programmatically. (6 rocusoyroRce Lightning Platform APIs @ BULK API Bulk API lets developers and admins perform CRUD (Create, Read, Update, Delete) actions on large datasets asynchronously in batches. Use this API when working with large volumes of data (hundreds of ‘thousands to millions of records). @ METADATA API Metadata API allows developers to programmatically retrieve, deploy, create, update, or delete customizations or metadata in an org. The most ‘common use of this API is in deploying changes from one org to anothe Migration Tool (@ rocusovronce Lightning Platform APIs @ STREAMING API ‘Streaming APIs used in receiving notifications based on record-change ‘events or custom events in Salesforce, Use this API to subscribe and receive real-time notifications related to changes within ane © APEX REST API ‘Apex REST API allows Apex classes to be exposed and invoked by external application as REST web services. Use this API when there is a need to,run Apex code from an external application and increase code Lightning Platform APIs APEX SOAP API =a Similar to Apex REST API, Apex SOAP API allows Apex classes to be | ‘exposed and invoked by external aplication as SOAP web services Use this API when ts required torun Apex code from an external pl a via SOAP API, @ TOOLING API Tooling API provides the abllty to write SOQL query for many metadata, typesin an org. This API provides SOAP and REST interfaces and can be used in creating custom Lightning Platform development tools or apps. (@ rocussnforce » Learn More =) @ Trailhead - Understand the Salesforce Architecture @ TheforcecomMultitenant Architecture @ eecution Governors and mits © Build Your oun Salesforce App @ Lishtning App Builder (@ rocusovrorce " Learn More @ witicnAvromationToolDol Use? © Vsing Aura Components @ sinetisnine wer components (© rocusoyroRce

You might also like