Friday, February 26, 2021

Salesforce: Lightning Record Page

What is the Lightning Record Page? 

Lightning Record Page is not the same as Page Layout, it is more than the Classic Page Layout.

From the above screenshot:
  • Red box = lightning record page
  • Blue box = page layout

Page layout (under the Detail tab) is part of a lightning record page. Page layout is required to show fields of the object until Dynamic Forms is widely available.

The "Related" tab contains related lists which are defined in the page layout.

Buttons at the upper right corner are also defined in the page layout, but this can be upgraded to Dynamic Actions which was introduced in the last few releases.

Lightning versus Classic

  • Lightning Record Page only for Lightning 
  • Page Layout is a heritage from Classic

Setup Lightning Record Page

Go to the object manager, open the object, and find the Lightning Record Pages tab, you can open the Lightning record page or view the page assignment.

there are two lightning record pages for this object

You can view and look up the lightning page assignment from the View Page Assignments button. Lightning Record Page can be assigned by:
  • App
  • Record type
  • Profile

From Lightning record pages in an object, click the View Page Assignments button, and you will be landed at the About Assignments tab,  use Look Up an Assignment to look up which lightning page is assigned to a specific App, Record Type, and Profile. 

Org Default tab displays the lightning page set as org default for that object, except where other assignments are defined, such as app default or app, form factor, record type, and profile.

App Default tab displays the lightning page set as the default lightning page for s specific App, except where other assignments are defined, such as App, Record Type, and Profile.

App, Record Type, and Profile tab to see if any lightning pages assignment based on App, Record Type, Profile, and Form Factor.

Assigning Lightning Page

Navigate to Lightning App Builder to view all lightning pages, or to create, edit, clone, or delete the existing lightning pages. 

By opening a lightning record page, you can see if the page is assigned to which app, record type, profile, also form factor.

But if you don't see anything here, it does not mean the lightning page is not used, as the page can be set as Org or App default.

To assign a lightning page, edit the lightning page, and click the Activation... button, from here you can:
  • Assign as Org Default
  • Assign as App Default
  • Assign based on App, Record Type, Profile, and Form Factor

Salesforce: Intro to Dynamic Forms

When Lightning introduced by Salesforce many years ago, it still depends on the "Classic" page layout. There has been a rumour for quite some time in the Salesforce community that we will be able to add fields directly in the Lightning app builder without the need for Classic page layout.

This finally comes true with Dynamic Forms. In the Winter '21 release, Dynamic Forms become Generally Available, but only for custom objects. As per, DreamTX 2020, the Dynamic Forms will be available in Summer '21 release, including for mobile support.

How to activate Dynamic Forms?

Dynamic Form needs to be enabled on each Lightning Record Page, so this means that you do not need to enable dynamic form for the whole org at once, you can enable it by the app, profile, or record type. So, you can pilot a profile with dynamic form, while all others still use Classic page layout within the same object.

Go to Object Manager, select the object, select Lightning Record Pages, to show all Lightning Record Pages that exist for that particular object, including other information such as Org Default, App Default, and Other Assignments.

There are two Lightning record pages for this object

Enabling Dynamic Forms

To enable dynamic forms, edit the lightning record page, this will open Lightning App Builder, select the Record Detail component, then click Upgrade Now button.

You will be presented with a wizard to follow to migrate the fields to the dynamic form. Optionally, you can select to enable migrating the fields and section into the Accordion component to improve the new page performance.

One-Way Ticket

Once a Lightning page is upgraded to Dynamic Form, you can't downgrade it back to Classic page layout. However, you can simply delete the Accordion or Field Section component, then adding back the "Record Detail" component which uses Classic page layout.

Sunday, February 21, 2021

Einstein Analytics: Sharing Inheritance

Security Predicate is great to set row-level security for Einstein Analytics user to access the dataset based on certain criteria, such as matching user custom field "Region" in Salesforce with data with a field call Region, so the user will only see data with the same region as per user detail. This will work whether data comes from Salesforce or from the external system.

However, if the data source is from Salesforce and we want to bring in row-level security based on Salesforce sharing, there is something called Sharing Inheritance. Sharing inheritance lets Einstein Analytics apply the same sharing setup for your datasets as Salesforce uses for your objects

However, there are a few limits to note when implementing Sharing Inheritance:
  • Each dataset can inherit sharing settings from one object, regardless of how many source objects are used to create it
  • All object records have fewer than 400 sharing descriptors each
  • Supported objects for sharing inheritance are: Account, Case, Contact, Lead, Opportunity

A sharing descriptor is the ID of the user or group that has access to the record. Sharing descriptors, tracked by Salesforce in the Object Sharing Table, ensure that only the listed users and groups can access the correct records. IDs are added to the sharing table for many reasons including record ownership, sharing rules, and manual sharing.

When object records and users have fewer than your org’s maximum descriptors, go ahead and apply Sharing Inheritance. If records exceed the limit, depending on your org’s sharing strategy flexibility, choose to reduce the number of descriptors per record or contact Salesforce Support to evaluate whether higher limits are an option.

You can build your own security predicate to mimic Salesforce sharing in dataflow, from record owner,  role hierarchy, teams, manual sharing, sharing rules, and etc. but it is way too complicated, check out this blog for almost complete. 

To implement Sharing Inheritance, go to the Salesforce setup menu, and enable it from Settings under Analytics. Once enable, navigate to Sharing Inheritance Coverage Assessment to assess if sharing inheritance can be used for a particular object and any users will not be covered:
  • Select the object
  • Click "View Assessment" to check if the object can use sharing inheritance
  • If yes, click "View User Coverage" to make sure if any users do not cover by sharing inheritance, this is for users with sharing descriptors more than max descriptors for the Org.

sample of sharing inheritance can be used in Account for all users

sample of sharing inheritance that cannot be used in Account, because some records have too many associated sharing descriptors

sample of sharing inheritance can be used in Case, but some users are not covered because those users have more sharing descriptors than the org limit

Sharing inheritance covers a user if they have “View All Data” permission, or their record access is granted by fewer than 3,000 (by default) sharing descriptors -- note that this is NOT the number of records visible by a user on that object. The backup security predicate takes effect for users with more than this number of sharing descriptors. Without a security predicate, users not covered by sharing inheritance see no data in the dataset, because they have no dataset row-level access.

For an object to appear in the security-sharing source list, the primary key of the custom object must be a field in the dataset. A foreign key doesn’t satisfy this requirement. For example, if you have Opportunity.AccountId in your dataset but not Account.Id, you can’t inherit sharing from the Account object.

To configure sharing inheritance in dataflow, on the Register node, select the object under Sharing Source. In dataflow JSON, this will be stored as "rowLevelSharingSource" parameter.

in this sample, I have Id (of Account) and Opportunity.Id fields

By editing the dataset, you can check the sharing source for that dataset, this should be similar to sharing inheritance defined in the register node in the dataflow.


Saturday, February 20, 2021

Salesforce: Email Alert Recipients

Email Alert can be used to send an email via Workflow Rule, Process Builder, or Flow. There are a few important items in the email alert:

The email alert will only available for the related Workflow rule or Process Builder. 

Email Template
We defined the email Subject and Body here, including using merge fields and adding attachments.

This can be users in Salesforce, or Contact, or Email address in fields, this is defined as Recipients Type. You also can add up to 5 email address directly entered in the email alert.

From Email Address (Sender)
Who will be the email sender? 
- The current user who triggers the email alert
- Default workflow user
- One of mailbox added into Organization-Wide Email Addresses

Recipients Type

Depends on your Salesforce licenses purchased and feature enabled, you may see more recipient type in the email alert. The list of recipients is the same for all objects. 

Org. with standard Salesforce license 

Org. with Communities/Experience Cloud

If you select particular recipients that are not relevant, such as Case Team for an Account email alert, this will be ignored. The same if there is no user/value for the selected recipient, this will be ignored too. If the recipient is the same user for more than 1 type, such as Account Owner and Owner (for Opportunity), the user will only receive one email, instead of 2 emails.

For Team, you need to select Team Roles, so all users for selected team roles will receive the email sent.

Check out this article for descriptions of each recipient type, some of them are very obvious, so I will not discuss them further.

Account Owner
This option works only for email alerts on accounts, opportunities, cases, contacts, contracts, and any custom object that is a child of the account object. If you select another object type or the associated account doesn’t have an account owner, Salesforce sends the email alert to the record owner instead.

Account Team
Emails are sent only when the rule is associated with the account object or its immediate child objects.

Email Field
All fields in the selected object with the field type = Email.

In object supported by queue, the owner here can be a queue, so all queue members or queue email (check here Queue Email) will receive the email.

Related Contact
All fields in the selected object with the field type are Lookup(Contact).

Related User
All fields in the selected object with the field type are Lookup(User).


Saturday, February 13, 2021

Salesforce: Email sent related to Case Assignment Rule

In the previous blog, we discussed the Queue Email and Case Assignment Rule. So ideally, upon case creation, we use case assignment rule to change the case owner to a queue based on the criteria defined in case assignment rules.


There are 2 things:
  • Queue Email
  • Send Email to Members

In the Queue Email blog, we said that email will be sent to queue members 
1. Queue Email is blank, regardless of the 'Send Email to Members' checkbox is selected or not
2. Queue Email is NOT blank, but Send Email to Members is selected.

Case Assignment Rules

When we look at Case Assignment Rule, there is Email Template that needs to be defined here, once Email Template entered, it will appear as a tick in the Rule Entries.

Rule Entries


Let's see how this work in the relation to Email Template in the Case Assignment Rule with Queue email setting:

For case change owner email notification, the default email template is "Support: Case Assignment Notification", however, you can change this under Support Settings in the Setup menu and looks for Case Assigned Template
Or, you even can remove template defined, then Salesforce will just send a simple message "Case transferred to you" with the content of Case number and Case URL.


From above for case assignment rule:
  • No email will be sent if no email template is entered in the assignment rule
  • Yellow highlight is aligned with point (1)
  • Green highlight also aligned with (2) -- for queue members + queue email
  • Manual change owner will use the standard salesforce email template for change owner
To have more granular actions when the email sent, you can use Workflow or Process Builder or Flow.

Tuesday, February 9, 2021

Salesforce: Roll up Activities to Account

In Lightning, activities can be configured as Activity Timeline or Related Lists. As an admin, you can configure this from Setup | User Interface | Record Page Settings | Default Activities View (desktop only).

However, users are also able to personalize the activities view on their own as Activity Timeline or Related Lists from Settings | Display & Layout | Record Page Settings.

Another thing that admin can configure is to enable roll-up activities to a contact's primary account, this means activities (event, task, and email) links to Contact will appear in their direct Account too. To configure this, navigate to Setup | Feature Settings | Sales | Activity Settings, enable roll up activities to a contact's primary account.

Additionally, activities (event, task, and email) in Opportunity and child objects (with Master-Detail relationship to Account only) will appear in Account too, this behaviour is applicable for both views with Activity Timeline or Related Lists. However, Case activities will NOT roll up to Account.

In summary,
* with "roll-up activities to a contact's primary account" is enabled
^ child of Master-Detail relationship

Notes: to enable Contacts links to multiple Accounts, look for Account Settings in the Setup menu, then enable Allow users to relate a contact to multiple accounts.

Activities will not roll up from the child to the parent in a custom object, even with the Master-Detail relationship.


Saturday, February 6, 2021

Salesforce: Sending Email from Case

In the previous blog, we discussed sending email from Salesforce, as we mentioned in that blog, there is a difference for sending email from the Case object with other objects (standard and custom). Probably that Case is considered as the main object in Service Cloud and related to Case Feed implementation.

Not Organization-Wide Email Addresses

Adding email to Organization-Wide Email Addresses does not relate to sender option in the email from Case, but you must enable Email-to-Case, then the email address from Email-to-Case will appear as sender in Case. Email address added to Organization-Wide Email Addresses will not appear as sender in Case.

Email tab

Instead of located under the Activity tab, the Email tab will be in the Chatter tab. The workaround is to add the Chatter component under the Activity tab, but this will also show Chatter items too such as Post, Poll, and Question.

Email address visibility

Different from email addresses added in Organization-Wide Email Addresses, where we can control the email address will only visible to which profiles. We do not have that option for Email-to-Case, so all email address added to Email-to-Case will appear for all users, feel free to vote this idea and this idea.


Salesforce: Users Report

Until Spring '21 Release, standard report such as reports in "Administrative Reports" folder does not exist in Lightning, check out the gap here. However, some reports such as "All Active Users" can be easily created manually in Lightning with Users record type, but other reports such as "API Usage Last 7 Days" build with API Usage report type does not exist in Lighting.

Access to Users report type

Issue: a user complains that he can't create or access reports build with Users report type, what is the cause?

Finding: the user does not have View Setup and Configuration permission, enabling this permission will allow the user to create (the user must have to Create and Customize Reports permission) and run the report created with users record type (the user must have Run Reports permission).

Enabling View Setup and Configuration permission will also enable View Roles and Role Hierarchy permission, this can't be disabled. Without View Roles and Role Hierarchy permission, the "User Detail" button will not visible when clicking a user name from the page layout.


Monday, February 1, 2021

Sending Email from Salesforce

As a CRM system, Salesforce offers basic functionality to send emails, let's check this out. 

Send from any objects
We can send email from any objects in Salesforce, but additionally, for Lead and Contact, the "To" will be automatically filled with the lead or contact's email, for other objects, it will be just blank. 

You can create a send email action in that object. In that action, set a predefined field value "To" with a field with the email address or from the related object such as Contact.

By default "From" would be your name and your email address as in Salesforce. If you notice in the top screenshot, there is BCC to yourself, this is because "Automatic BCC" is enabled in your email setting. You also can add your email signature from "My Email Settings".

Overwrite Sender
As the above screenshot, you can change your name in sender email from "How would you like your name to appear on your outgoing email?", also overwrite the email address in "What email address would you like to use as your return address?"

You need to verify the request in the new email address, once verified, you will see the sender as new email address, instead of your original email address.

Organization-Wide Email Addresses
Can we add a general email as the sender "From"? Yes, an organization-wide email address associates a single email address to a user profile. Each user in the profile can send an email using this address. Users will share the same display name and email address.

This email must be a valid email address because it needs to be verified. Let's add emails to the organization-wide email address. Go to the setup menu, search for Organization-Wide Addresses, click Add button, select profiles allows able to use this email address as a sender.

Now, open a lead or contact or any other records, you should be able to select the new email address added as the sender, usually, this would be a shared mailbox or distribution list.

However, all the above mentioned is NOT applicable to the Case, you will not see the Email tab in Activity by default. Salesforce treats Case on its own, with additional Email-to-Case and Web-to-Case. We will discuss sending an email from Case in the next blog. 


Page-level ad