Friday, January 15, 2021

Salesforce: View Dashboard As

In addition to Create and Customize Dashboard permission, there are a few more permissions related to the dashboard, such as Create Dashboard Folders. But to control dashboard builder on "View Dashboard As", there are 2 permissions related to this.

1. Only Create and Customize Dashboard permission

This user will not see the "View Dashboard As" option under dashboard properties

2. With View My Team's Dashboards permission

This user will see "View Dashboard As" with options: me and another person only.

3. With Manage Dynamic Dashboard permission

This user will see "View Dashboard As" with options: me (dashboard creator), the dashboard viewer (login user) with the option to let the dashboard viewer choose user beneath them in the role hierarchy.

For "me", do not select anything.

4. With View My Team's Dashboards + Manage Dynamic Dashboard permission

This user has all option to configure the dashboard for "View Dashboard As"

However, for "another person", you can choose any user below you in the role hierarchy. You can choose any user in your organization to be a running user of the dashboard if only have View All Data permission.


Salesforce: Dynamic Dashboard Limit

Limit! Yeah, all Salesforce admins and developers know about the limit in Salesforce, including the limit in Unlimited Edition. This blog is not about what is Dynamic Dashboard, so I will not explain again what is Dynamic Dashboard. 

In short, what actually is Dynamic Dashboard? Instead of viewing the dashboard as someone, a dynamic dashboard allows login the user to see the dashboard data as themselves (similar to the report) or choose to view it as someone else beneath the user in the role hierarchy.

As per the current Winter '21 release, the limit of the number of dynamic dashboards you can have in your org. based on the edition purchased:
  • Performance and Unlimited Edition: up to 10 per organization.
  • Enterprise Edition: up to 5 per organization.
  • Developer Edition: up to 3 per organization
You can purchase from Salesforce to increase the limits, also feel free to vote for this idea.

To find all dynamic dashboards that have been configured, you can query with

SELECT Id, Title, Type FROM Dashboard WHERE Type = 'LoggedInUser' OR Type = 'MyTeamUser'

Or run a report by creating a custom report type of Dashboard object, then add a filter 

Dashboard Running User equals "Run as logged-in user, Let authorized users change running user"

Selecting "The dashboard viewer" (in yellow) only is equal to LoggedInUser in a query or Run as logged-in user in the report. 

Adding with select of "Let dashboard viewers choose whom they view the dashboard as" (in green) is equal to MyTeamUser in a query or Let authorized users change running user in the report. 

For query, the description for Type:

  • SpecificUser — The dashboard displays data according to the access level of one specific running user (1st and 2nd radio buttons).
  • LoggedInUser — The dashboard displays data according to the access level of the logged-in user.
  • MyTeamUser — The dashboard displays data according to the access level of the logged-in user, and managers can view dashboards from the point of view of users beneath them in the role hierarchy.

Note: Deleted dashboards with dynamic dashboards in Recycle Bin still counted to the limit.


Thursday, January 14, 2021

Einstein Analytics: Many-to-Many data transformation

I am a big fan of Dataflow and not Recipe (Dataprep), however, Dataflow will not work when you deal with a multi-to-multi data source. 

In Dataflow, you always have a 'table' that will define the granular data, you can 'clone' the data into multiple streams, then use append node to combine them back, so the granular data exploded. However, you cannot 'explode' the data based on data from a different dataset.

Here samples of data:

This is the expected result

The objects relation

Solution: using Left Join in Recipe

1. Create Recipe

Go to Data Manager > Dataflows & Recipes tab > Recipes tab > Create Recipe button

2. Select Data

Now you are on a blank canvas, click the Select Data button.

Select left dataset, click +, select Join, select right dataset, makes sure you have key align for both datasets, in my sample is Opportunity Id.

Select Left in Join Type, make sure to select all fields to be included for the result, then click the Apply button.

You can preview the result from the Preview tab.

3. Add Output node

Enter the label and API name for the result dataset and we are done. 

Here is the dataset created

Opportunity Id 006A5 in the custom object does not appear in the result, because we are using left join, so it will contain only the left dataset key

Select Right if want to make the right dataset is the key, here is the result.

Use Inner, if the key should exist in both dataset:

And the last one Outer, where all data will be included


Monday, January 11, 2021

Salesforce: Queue Email

When creating a queue in Salesforce, you will notice 2 things specific to the queue:
  1. Queue Email -- this is an email address
  2. Send Email to Members -- this is a checkbox

What is Send Email to Members?
Is this mean if this checkbox not selected, then the queue members will not receive emails? No, if this checkbox is not selected, the email will be sent to Queue Email, not to individual members anymore, but Queue Email must be populated.

What is the usage of those fields?
An email will be sent to all queue members individually (users added to the queue) if 
  • Queue Email is blank, regardless of the 'Send Email to Members' checkbox is selected or not
  • Queue Email is NOT blank, but Send Email to Members is selected.

In other words, if you have a shared mailbox or email distribution list for a queue, enter that email address to the Queue Email and make sure Send Email to Members is not selected.
The email will be sent related to:
  • manual owner assignment
  • case/lead assignment rules
  • workflow
  • process builder
  • etc.

If you need to disable email sent to individual members and also not to a specific email:
  • Do not enter dummy/fake email addresses, this can result in your Organization's email being disabled until this is corrected due to email blocklisting.
  • append .invalid at the end of the address, any emails sent to a domain ending in .invalid will be discarded by the Salesforce email agent. e.g.


Thursday, January 7, 2021

Salesforce: Export Query Result from Developer Console

In case you have no access to the workbench, can we download the query result from the Developer Console?

Build a Query in Developer Console

Open Developer Console, File > Open > Objects > select an object > click Open (or double click the object name). 

Select the fields by hold the Ctrl key (and Shift key) for Windows users, then hit the Query button, Id field will be auto-added.

Click the Execute button, developer console will open a tab with the query result.

Export query result to Excel file

This is tested in Chrome and chromium-based web engines (such as Edge and Opera), so not sure for Firefox and Safari.

Right-click on the query result and select Inspect.

Look for the table tag, then do "Copy element".

Open Excel and Paste to get the result.


Wednesday, January 6, 2021

Salesforce: Mass Close Case

Two years ago, I blog on using quick action to mass update a field from a list view, check out this blog. This blog is to use the same approach, but allow the user to enter data before doing the mass updates.

Use case: Universal Container would like to allow the Marketing team to do a mass close case, however, the user must enter a reason in a custom field before closing the case.

Inline editing support edit Status in the list view, however, the custom field for reason is a long text area field, which is not supported by inline editing, see this limitation here.

Solution: implement Quick action for List View

Note: I have seen many consultants customize this by using visualforce page and apex class which is not necessary and over-engineer, when click-not-code can achieve the same result and easier to maintain.

1. Create New Action

From the Setup menu, navigate to the Case object, look for the Buttons, Links, and Actions menu. Click the New Action button, enter/select the following values:

Add the custom field for reason and remove all other fields, make the field as required if necessary.

2. Add Predefined Field Values

Still in Mass Close Case action created, scroll down to Predefined Field Values section, then click the New button, enter the as below and save.

3. Add button to the layout

Stay in the Case object, click Search Layouts for Salesforce Classic menu, then click Edit under the arrow on List View. "Mass Close Case" should be available under "List View Actions in Lightning Experience"

Select the action and click the add arrow button.

4. Case tab

Click the Case tab, you need to select a view, except Recently Viewed. You should see the "Mass Close Case" button, you maybe need to click the arrow button to show the new button, if too many buttons added to the list view.

5. Select records

Select a list view, but not the default "Recently Viewed", then select multiple case records. Click the "Mass Close Case" button, you will be presented to enter a reason to close the case, this will update the Status and Internal Comments field for all Cases selected. Click the Save button, and then the OK button to confirm.

All Case Status updated to Closed and all "Internal Comments" with "PO created".

Monday, January 4, 2021

Salesforce: Activities & Chatter component

When you edit the Lightning page of an object, in some scenarios, you may not find the standard Activities & Chatter components, why?

When I edit the Lightning page of a custom object, here what I see:

Activities component which is a standard component, but not available for this object. Why? In short, you need to enable the activity for that object.

Go to object manager, open that object, you will be landed at the Details page, and click the Edit button then select Allow Activities.

Once enabled, you should see the Activities component.

Same with the Activities component, the Chatter component is also a standard component, and you may not see it too (see above screenshot), the same for Tab component, you may not see Chatter listed as a standard Tab label.

To enable Chatter for the object, you need to enable it from Setup > > Feed Tracking, looks for the object, and enable Feed Tracking, you are not required to select any fields for tracking, but you can select as needed.

Once saved, you should see the Chatter, Chatter Feed, and Chatter Publisher components in the lightning page app builder.

Feed Tracking
You may curious what is the purpose of selecting fields in the field tracking, which I said not required to show Chatter components?

Let's test how this works? Back to the Feed Tracking page and select that object, now select a few fields. For this blog, I am going to select Type and Industry.

Now, back to open the record, click the Edit button and change the Type and Industry, then save. Open Chatter component and now you should see the changes here.

Feed tracking is not the same as Field History Tracking, where we need to enable from object level, then set fields to track object manager. The fields enabled for tracking between feed tracking and field history tracking can be different.

  • Create a new record and populate fields enable for feed tracking, this action will NOT track under Chatter Feed -- same with Field History Tracking, fields will NOT be tracked on new record creation, Field History Tracking only track when the record is created and by who.
  • Populate tracked fields from blank will be tracked in both Feed Tracking and Field History Tracking.
  • Remove (make blank) on tracked fields from blank will be tracked in both Feed Tracking and Field History Tracking.
Feed Tracking

Field History Tracking

Sunday, January 3, 2021

Salesforce: Customize Log a Call button

 More than 2 years ago, I blog on Log a Call button does not appear in Activity, this blog would be the continue with the following scenario: 

  • Instead of call "Log a Call", we need to name it "Log an Activity"
  • Add a custom field in the "Log an Activity" panel called "Area"
  • Add "Area" field in the Activity logged panel

Add custom field
From Object Manager, you will not see the New field button in the Task object, but go to the Activity object, then you will see the New button in Fields & Relationship.
Create the custom field here, you may choose to add the field to Event and Task layouts.

Create "Log an Activity" action
From the Setup menu, go to Global Actions, then click the New Action button, select and enter the data then click the Save button.

You will see a layout to add/remove fields for the new action, let us add "Area" here, click the Save button once done.

Add "Log an Activity" action to Activity component
Let us add the "Log an Activity" action (and remove the "Log a Call" action if exist) from Contact. Go Contact object from Object Manager, open a page layout (make sure this is the correct page layout). Look for the "Salesforce Mobile and Lightning Experience Actions" section, if you see the message "Actions in this section are predefined by Salesforce", click the "override the predefined actions" link.

Click "Mobile & Lightning Actions" at the top panel then drag the "Log an Activity" action to the "Salesforce Mobile and Lightning Experience Actions" section, also remove the "Log a Call" action if exist. Click the Save button when done.

Now you should see the "Log an Activity" tab (with Area field) under Activity in Contact.

Once the activity saved, it will show as a closed task, but Area is not added yet.

Add "Area" field in the Activity logged panel
Navigate to Task object from object manager, click Compact Layouts tab, then New (or edit existing compact layout), add Area field, I also add a few more fields such as Status, Created By.

Click the "Compact Layout Assignment" button to assign the newly created layout as the primary compact layout.

The "Subject" will appear on the top (next to the icon) and the "Description" field will be shown by default. If you go to Account, you will see the same task too, because, by default, activities from Contact will roll-up to Account. However, there is a small difference here, instead of showing "you logged a call about" account name, here you will see the task with "you logged a call with" contact name.


SimplySfdc in 2020

Happy New Year 2021! To follow the yearly tradition, I would like to share some statistics of SimplySfdc in 2020 -- here is the statistic for 2019.

In 2020, lesser blog posts are written compared to 2019 (24% less), but the total Pageviews and total Sessions are increased quite significantly.

Total New Page293863-23.68%
Total Pageviews305,957210,213171,24945.55%
Total Sessions271,214185,396149,57446.29%
Pages / Session1.131.131.14-0.51%
* compare 2020 to 2019

Similar to previous years, organic search contributes as the largest portion of traffic source in 2020, this year, organic search contributes more than 82% of the total traffic -- a huge increase of more than 12%. While Direct traffic drops for almost 10%, traffic from Referral contribute more percentage, but Social is weaker in 2020.
Channel Source202020192018
1. Organic Search82.86%74.06%69.63%
2. Direct13.73%23.25%27.15%
3. Referral2.69%1.72%1.76%
4. Social 0.71%0.82%1.46%
Google, as always is the king of search engines globally, the same applies to SimplySfdc visitors in 2020, Google contributes a slightly more traffic than in 2019, but still lower compared to 2018. Bing, Yahoo, and other search engines contribute a lower percentage compared to their portion in 2019.

Top Search Engine202020192018
1. Google96.85%96.09%97.48%
2. Bing2.12%2.61%2.02%
3. Yahoo0.44%0.56%0.48%
4. Other0.57%0.74%0.03%

This year, LinkedIn takes over as the #1 contributor from the social media channel, LinkedIn's traffic is more than double of Twitter's traffic, this makes sense as my LinkedIn networks grow exponentially, compare to grow of my Twitter follower, not many changes of traffic from Blogger and Facebook in 2020.
Top Social Media Source202020192018
1. LinkedIn 49.77%31.57%15.65%
2. Twitter 22.10%39.05%56.50%
3. Blogger 18.33%20.21%4.17%
4. Facebook 5.63%5.57%18.00%
5. Others4.17%3.60%5.68%
There is no change in the top 3 countries of the visitors, however, US visitors drop quite significant by more than 6%, visitors from India increase by more than 3%. Canada takes over Australia in positions #4 and #5 with around 3%. Surprise for Singapore, my home country, jump to #6. The top six countries represent more than 76% of the total visitors, however, this is lower than 2019, where the top 6 countries represent more than 78% of the total visitors.

Top Visitor Country202020192018
1. United States37.27%43.60%41.84%
2. India25.20%22.07%23.88%
3. United Kingdom 4.78%4.50%4.95%
4. Canada3.09%2.85%2.92%
5. Australia3.03%3.20%3.30%
6. Singapore 2.76%1.50%1.43%
* France was in #6 in 2019
* Singapore was in #8 in 2019 and 2018
From the cities' perspective, most familiar still appear in the top 6 cities. Chicago no longer in the top 6, although it was #1 in 2019. Bengaluru, London, and New York show lower percentages year over year since 2018. The top 6 cities represent more than 14% of the total visitors, this is much lower than 2019 where top 6 cities are close to 22% of the total visitors.

Top Visitor City202020192018
1. Hyderabad3.86%3.27%3.76%
2. Bengaluru 3.80%5.27%6.08%
3. Pune2.38%2.20%2.32%
4. London 1.86%2.14%2.50%
5. Chennai 1.80%1.86%1.83%
6. New York1.45%2.26%2.30%
* Chennai was #7 in 2018
* Chicago was #1 in 2019 and drop to #9 in 2020
This statistic includes access from desktop and mobile. Total top 5 web browsers contribute more than 98% of the visitors. Chrome again proves as the default web browser for everyone, and this year, it still increases for more than 5% of all visitors. Safari takes over to secure #2 by adding a small percentage, Firefox stays at #3 but with a lower percentage. Internet Explorer drop to #5, this is aligned as Microsoft already stop Internet Explorer by introducing Edge as the replacement in the last few years. 

Top Visitor Web Browser202020192018
1. Chrome88.78%83.13%83.34%
2. Safari3.13%2.91%3.28%
3. Firefox 3.10%3.57%4.64%
4. Edge2.64%1.58%1.71%
5. Internet Explorer0.98%7.05%5.43%

In terms of the operating system, there is no change in the top 5 operating systems. Windows users decreased by more than 3%, while Macintosh and Android gain close to 2% compared to 2019. iOS and Linux have a slight increase and decrease, but do not change anything.

Top Visitor Operating System202020192018
1. Windows70.59%74.19%75.13%
2. Macintosh19.57%17.63%17.12%
3. Android5.16%3.28%3.15%
4. iOS 2.80%2.57%2.80%
5. Linux1.34%1.65%1.36%

As mentioned in last year's blog, screen resolution 1536x864 probably is 1920x1080 resolution with the display set to 125% zoom, and 1280x720 is 150% zoom of 1920x1080. So in total, 1920x1080 contributes to more than 47% (an increase from 42% last year) of the total visitors. 

Top Visitor Screen Resolution202020192018
1. 1920x108024.34%24.38%21.87%
2. 1366x76815.14%15.62%20.09%
3. 1280x72012.65%8.75%6.63%
4. 1536x86410.44%8.88%8.53%
5. 1440x900 8.03%7.95%8.23%
6. 1680x10503.70%4.15%4.04%
 * 1680x1050 was #7 in 2018 and in 2019

Top 5 Popular Page
For popular pages, 4 of 5 top pages from 2019 stay in 2020, 3 of 5 top pages in 2019 are written in 2018, and 1 of them are written in 2019 which is related to Einstein Analytics.

2. Salesforce: Convert ID from 15 to 18 characters with Excel formula ~ 7,009 hits [2018] (#3~2019, #15~2018)
3Salesforce: List View Mass Action in Lightning Experience ~ 6,862 hits [2018] (#1~2019, #4~2018)
5. Salesforce: How to export Attachments? ~ 5,198 hits [2014] (#2~2019, #1~2018; #1~2017; #4~2016; #4~2015; #5~2014)

Top 5 Referral Site
Although I do not really promote my blog in trailblazer and Salesforce developer community, however #Ohana shared my blog to the community which is contribute for more than 27.5% of the total referral

4. linkedin ~ 10.49%
5. twitter ~ 5.26%

Page-level ad