Tuesday, November 13, 2018

Salesforce: Enhanced Email

With Enhanced Email, emails sent from Salesforce are logged as Email Messages and Tasks, read this as: Salesforce create 2 records: 1 record in EmailMessage (02s) and 1 record in Task (00T). There is a field in EmailMessage point to Task called ActivityId. EmailMessage is a standard Salesforce object, and that’s how you get all of these great new email features.

Check this SOQL for the object structure:
SELECT Id, ActivityId, CreatedDate, FromName, Subject FROM EmailMessage ORDER BY CreatedDate DESC

To enable Enhanced Email, go to setup menu, search for Enhanced Email, and click Enable button. All existing email sent prior enable enhanced email will NOT change.

Let's see the different of email sent before and after enable Enhanced Email in the Past Activities panel.

yellow = before; green = after

Now let's click the email.


Unlike the Task object which is editable, Email Messages cannot be edited through the User Interface or the API.

One more thing to notice, after enable Enhanced Email, you can track if the recipient have open the email.


You also can check when the email first and last opened.

ReferenceEnhanced email and the Email Message object

Monday, November 12, 2018

Salesforce: Case and Lead Team Report

We discussed about Account Team Report and Opportunity Team Report more than two years ago. In this blog, we would share on Case and Lead team report.

Let us start with Case, when you check options under "Show Me" filter, here are the options:

In the samples below, we'll login as Maria Ann:

My cases: ONLY cases that you OWNED.

User owned cases: all cases owned by a user (not a queue)

Queue owned cases: all cases owned by a queue (not a user)

My case team's cases: ONLY cases where you are on the Case Team, this NOT includes where users under your role hierarchy added as Case team.

My role-based team's casesCases you OWNED & cases owned by all of your subordinates in the role hierarchy.

** this is all cases owned by Maria Ann and her subordinates.

Now, let us look at "Show Me" filter available in Lead, here are the options:

We'll not discuss again for: My leads, User owned leads, Queue own leads, and All leads, but let us see what is the result for My team's lead.

** this is all leads owned by Maria Ann and her subordinates.

Sunday, November 4, 2018

Salesforce: easier way to see what is inside a Permission Set

When you enable a permission using permission set or profile, Salesforce will automatically enable other permissions needed to enable that permission. Salesforce will tell you what permissions will be enabled when you enable a permission, however, it will not tell you other permissions will be enabled by enabling the required permissions. Imagine this, to enable permission A, the system will tell you that it will enable permission B as well, however, to enable permission B, it needs to enable permission C and D, so you are not aware that C and D actually enabled by a Permission Set.

For this example, I create a permission set to enable a permission called "Activate Contracts".

From the above screenshot, you aware that, by enabling Activate Contracts, it will enable Edit Order and Edit Contract, and not more than that. But, let's check with Setup Audit Trail.

Let us see each line from the above audit trail screenshot:
5th - create the permission set
4th - enable read and edit for Contract object, this makes sense that to edit, the user needs to read
3rd - enable read for Account object, this is because Contract record accessibility depends on Account.
2nd - enable read and edit for Order object, this makes sense that to edit, the user needs to read
1st - enable the permission set

Because the permission set is just created, we can monitor it from the audit trail, but for the existing permission sets, you can't find the history after 6 months. So, you need to open each tab in the permission set - that's not ideal :(

Also for the scenario where you have many admins and the documentation practice is not strong, some admin adding permissions without other admin awareness, so you have no visibility of what is inside the permission set.

Is there an easy way to tell what is "inside" a permission set?
Yes, as Salesforce awesome admin, you are supposed to fill in the "Description", this will help yourself in the future, or your successor. However, Description only can have maximum 255 characters.

Check with Metadata
Because of all extra permissions in the permission set are written as metadata, you can download the permission set metadata and "see" all permissions enabled for the permission set with a simple text editor.

Salesforce inspector comes to help, it is pretty handy and nothing needs to be installed to your Salesforce org., just follow the step to download permission set metadata into a zip file.

Salesforce inspector panel

select permissionsets and click Download metadata

wait for a few seconds to download the metadata

Extract the zip file, each permission set will be stored as a file with the extension ".permissionset". Open the file with a text editor, such as Notepad++, now you have full visibility the content of that permission set, it will tell field permission, object permission, custom permission, apex class, tab setting, apex page, user permission. etc.

<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="">
    <label>Activate Contract 2</label>

Another option is to use PermComparator, however you need to switch between User Permissions, Object Permissions, and Setup Entity Permissions to see all extra permissions added in the permission set.

However, from my experience, PermComparator does not list all permissions, probably it has not been updated for a while, example: Allow View Knowledge, Subscribe to Reports.

Friday, October 19, 2018

Salesforce Inbox License

We did write how a blog on how to check Einstein Analytics License Assignment, this blog will share about checking Inbox license in Salesforce Classic and Lightning.

Inbox License Assignment are pretty similar to Einstein Analytics License Assignment, you can see how many Inbox total licenses you have, how many licenses used and remaining licenses in Company Information under Permission Sets Licenses in the setup menu.

Next question, I would like to see who has this licenses assigned? If you are in Lightning, this is pretty simple, search for Inbox in the setup menu and you will see Users and Licenses.

But, how about if I am still in Classic? short answer, flip to Lightning :) anyway, you can run SOQL to get the user if you are still in Classic, here you go

(SELECT AssigneeId FROM PermissionSetLicenseAssign WHERE PermissionSetLicense.MasterLabel ='Inbox') AND IsActive=true

Next, if I manually open the user detail, how I can see if the license has been assigned? Is it under Permission Set Assignments or Permission Set License Assignments related list? This is exactly the same with Einstein Analytics licenses assignment, once you add the Permission Set, the Permission Set License will be auto added, but not the other way round.

From above screenshot, once you add "Inbox With Einstein Activity Capture" permission set, Inbox license will be auto-granted.


Thursday, October 4, 2018

Einstein Activity Capture

Einstein Activity Capture is introduced on Summer '18 release, it is free up to 100 licenses for org with Sales Cloud license. When sales rep connects their Google™ or Microsoft® account to Salesforce, activities from those accounts show up on business and person accounts, contacts, leads, opportunities, quotes, and contracts in Salesforce. Plus, reps get read-only access to the Activities dashboard, which lets them view a summary of sales activities.

Step to enable Einstein Activity Capture:

1. Activate Einstein Activity Capture
Reach out to Salesforce Support to enable Einstein Activity Capture. Once enabled, you should see Einstein Activity Capture under the setup menu.

Then, enable Einstein Activity Capture from Setting menu.

2. Assign Permission Set to user
You need one of the following Permission Set depends on your license:
License = Sales Cloud Einstein --> Permission Set = Sales Cloud Einstein  
License = Inbox --> Permission Set = Inbox with Einstein Activity Capture
License = Sales Cloud --> Permission Set = Standard Einstein Activity Capture

3. User Setup
Once the permission set given to the user, the user needs to configure it from their setup menu. Click username from the top right corner, click Settingslooks for Einstein Activity Capture, then click Settings

It will popup Meet Inbox window, then click Next and follow the wizard. 

Then, select a Google or Microsoft account to connect.

Once account added, it will be shown in Connected Account under user Einstein Activity Capture setup menu.

Here you have the option if you want to share the emails and events to Everyone, My Groups, and Only Me.

Activity Sharing

Only Me
Events - Others see only the event's date, time, and attendees.
Emails - Others see only an email's sender, recipients, and date.

Events - Others see all details for the event.
Emails - Others see the full contents of the email.

My Groups:
Events - Group members see all details for the event. Others see only the event's date, time, and attendees.
Emails - Group members see the full contents of the email. Others see only the email's sender, recipients, and date.
Group here is refer to Private or Unlisted Chatter Group, if you are a member of the group, but it show "You have no groups to share with. To share with a group, join or create a private or unlisted group that allows sharing". This mean the group has not been enable for sharing.

You can enable Chatter Group sharing from:
  • Go to your Chatter Group 
  • Click on Edit Object from the upper right corner;
  • Select Page Layout;
  • Add the Enable Email and Event Sharing field checkbox;
  • Click Save.
  • Then Go back to the Group
  • Edit the Group and check the field "Enable Email and Event Sharing field" checkbox;
  • Click Save.

4. The Moment of Truth

Sending an email out using your email client to Contact or Lead
Based on the email sent out, Salesforce will automatically tag the email to the Contact or Lead as Past Activities. You need to make sure the email address in Salesforce is correct.

Contact reply your email
When your contact email you and his/her email address is in Salesforce, the email will auto added as Past Activities too.

What happened if more than one Lead or Contact with the same email address? 
The email correspondence will be linked to all Contact and Lead.


Monday, September 10, 2018

Einstein Analytics: Embed Dashboard to Salesforce Classic

As you see in the previous blog Embed Report Chart to Page Layout, adding report charts to record detail page is pretty simple. But, embedding Einstein Analytics dashboard to record detail page is different.

You can add Einstein Analytics dashboard to record detail page similar with Report Chart in Classic, but it will not show when you open the same record in Lightning. In this blog, I'll share on adding Einstein Analytics dashboard to record detail page in Classic only.

When you edit the page layout, notice "Wave Analytics Assets" and all available dashboard can be added to the page layout.

But, not as simple as adding report charts to the page layout, when adding Einstein Analytics dashboard to the page layout to show relevant record being viewed, you need to play a bit with JSON to link record Id to Einstein Analytics dashboard.

Here is the complete format of JSON to add in the field mapping, all words in yellow highlight are keywords.
"datasets": {
    "dataset1": [
        {"fields": ["field1"],
           "selection": ["$selection1", "$selection2"],
           "filter": {"operator": "operator1", "values": [["$value1, $value2"], ["$value3", "$value4"]]}
        {"fields": ["field2", "field3"],
           "selection": ["$selection3", "$selection4"]
    "dataset2": [
        {"fields": ["field4"],
           "filter": {"operator": "operator2", "values": ["$value5"]}

Sample: when open account page, auto filter Einstein Analytics dashboard with Account being viewed. Add the JSON into Field mapping of Asset Properties.

Let us analyze the JSON code:
1:  {  
2:   "datasets": {  
3:     "OptyWithAcct": [  
4:      { "fields": ["AccountId"],  
5:        "selection": ["$Id"]  
6:      }  
7:     ]  
8:   }  
9:  }  
- line 2: datasets is the keyword, nothing to change
- line 3: OptyWithAcct is the dataset name
- line 4: fields is a keyword, AccountId is API field name in the dataset
- line 5: selection is a keyword, $Id is the API field name from the object, not from the dataset

Let us see the result:

1. The dashboard is automatically filtered with current Account Id.
2. You need to have Account Id as list filter in the dashboard, otherwise, we can't filter the dashboard.

ReferenceEmbed Analytics Dashboards in Salesforce Classic Pages