How to display a modal window using lightning web components

We will go through building a reusable lightning web component that you can use to show modal windows in other LWC components.

Use cases

  • Display modal window or popup window in user interface


Explanation

We can use lightning design system sample modal code in the link to show the modal window. But to implement opening and closing behavior of the modal, we need to use javascript variables in lwc. We will create a reusable lwc component with name "utilModal". This will have code needed to show and hide modal window. Then we will create a sample parent component with name "modalParentExample" that we can use embed modal component. We fire custom events from utilModal component and parent "modalParentExample" catches these events. Parent component can use these action handlers to execute actions when buttons in modal window are clicked.

How to use

  • Create an LWC component with name utilModal
  • Copy content from above code to utilModal component. utilModal.html is the HTML file and utilModal.js is the Javascript file
  • "modalParentExample" has sample code to open modal window

How to use platform cache - with example

Platform cache allows you to cache data in Salesforce server. Accessing platform cache is faster than getting data by querying from objects or custom settings.

Use cases

  • Storing API session token till it expires
  • Caching frequently called API response data
  • Caching results from time consuming operations like complex queries and calculations

Types of platform cache

  1. Session Cache

    Stores data in association with user’s session. Maximum life is 8 hours. Only the user who put data to this cache can retrieve it back.

  2. Org Cache

    Data is stored at the org level. Any user can access data in cache.

How to setup

  • Go to Setup -> Platform Cache
  • Click on “New Platform Cache Partition” button
  • Enter necessary details and click “Save”. You can select “Default” checkbox to make the partition your default partition to avoid specifying partition name which caching data



It is recommended to create a separate class to manage all operations with cache. You can see an example of using a service class to manage org cache below. CacheService class is used to just manage cached data and ExternalSystemAPI class leverages that class to cache access token.


Salesforce Certification Maintenance Exams Spring 2019

        Here we are covering major features of Spring 19 release that are part of maintenance exams for different Salesforce certifications

Lightning Web Components(LWC)

        Salesforce introduced new lightning web components or LWC. It is another front end framework with lot of differences with Aura framework. LWC is way faster than Aura and uses modern web technologies like “Web Components” that got standardized after Aura was released in 2014. Aura and LWC components can coexist and admins will not see a difference in the way both operate.

Changes to Rich Text Editor

        Historically Salesforce was using CKEditor(open source) to show rich text field available in Salesforce interface. Now Salesforce is using another open source library called Quill to do this. This is because Quill plays better with locker service.

New Flow Builder

        Salesforce is replacing it’s old flow builder (called cloud flow builder) with new simplified graphical tool called Flow Builder. New interface is way more intuitive and you can access it while creating new flows or editing existing flows.

New interface to setup Sales Process

        Sales Process in Salesforce allows you to customize different steps of your sales operation. Historically you needed to setup Lead process to define different status values in lead and Sales process to define different stage values and probabilities in opportunity. This was a time consuming process. New interface to setup Sales Process allows you to define both Lead Status and Opportunity statuses in one shot in a single wizard with side by side view of both statuses.

Joined reports for lightning experience

        This feature allows up to 5 report blocks to be viewed side by side in a single joined report. To use this feature,

  • Edit any existing report in Salesforce
  • Click dropdown icon next to “Report” option in the view top left
  • Select “Joined Report” from the drop down and apply
  • Use “Add Block” button to add new reports

Other features

  • Option to remove all Account team members in one shot.
  • Ability to promote sub tab in lightning workspace to a main tab or workspace tab
  • You can create “Account Relationship Data Sharing Rules” to share some standard objects and custom objects with partners
  • Ability to specify relative values using macros while populating Date, Time, DateTime field values. For example you can specify due date of a task as “n days from today” in macro
  • Ability to change template in a lightning page that is already created
  • Admins can control visibility of components in lightning page based on user’s permissions. For example if user has “API Enabled” standard permission, show a particular component.
  • While specifying default value of fields, now you can use values configured in custom metadata type.
  • There is a new clause “WITH SECURITY_ENFORCED” that you can add at the end of SOQL in Apex to enforce field level security check. Example “SELECT Id, (SELECT Id, FirstName FROM Contacts) FROM Account WITH SECURITY_ENFORCED” will fail if the user does not have view permission on FirstName field

Trailhead to complete for administrator certification maintenance

        https://trailhead.salesforce.com/content/learn/modules/administrator-maintenance-spring19

Trailhead to complete for Platform App Builder certification maintenance

        https://trailhead.salesforce.com/content/learn/modules/platform-app-builder-maintenance-spring19

Trailhead to complete for Platform App Builder certification maintenance

        https://trailhead.salesforce.com/en/content/learn/modules/platform-developer1-maintenance-spring19

Trailhead to complete for Data Architecture Designer certification maintenance

        https://trailhead.salesforce.com/en/content/learn/modules/data-architecture-designer-maintenance-spring19/maintain-your-data-architecture-designer-cert-spring19