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 admin and developer 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 numbers of the 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 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 button).
  • 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.


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 Email to Members?

Is this mean if this checkbox not selected, the queue members will not receive emails related to the queue? No, if this checkbox not selected, this means the email will be sent to Queue Email, not to individual members anymore, Queue Email must not be empty.

Actually, 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 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".

Page-level ad