Wednesday, February 28, 2018

Salesforce Lightning Reporting and Dashboards [All You Need to Know]

1. It's All About Power, Speed, and Simplicity

Reporting in the Salesforce platform is one of the most powerful features available for all Salesforce users. With a bit of basic knowledge, you can create a report from scratch in less than 2 minutes, and get the report result within seconds!

You can simply drag and drop fields you need in the report, group the fields, add a summary, add filters, add a chart, etc. - all of these features available in the platform without having your IT guys or developers write script that would take weeks or months.

2. It's Your Record Visibility, and Accessibility

Salesforce is a record driven platform. You can report all records and fields that you are able to see, no matter who creates the record, who the record owner is, when the record is created, and even for fields that are not visible in the page layout or Lightning page.

Once the report is created, you can store it to your personal report folders, so no one will be able to view or modify it. When you need to share the report, just move or copy it to a public report folder accessible by other users.

3. Report Folder Control the Report Accessibility

Report visibility and edibility is controlled on where the report is stored, but not controlled by the report itself. A report is always stored in one folder only, whether it’s a public folder or a private folder. Users with special permissions will be able to view all reports stored in public folders, even if their name is not shown in the share folder detail.

4. Permissions Control Everything

Permissions can be set in Profile and Permission Set. Permissions don’t only control record accessibility, such as the ability to create Account, Contact, and so on, but it also allows you to run report, create report, subscribe report, and so forth.

5. Report is the "Parent" for Dashboards

Dashboards in Salesforce are built on components, and each component requires a report to serve as the data source. But, not all types of reports can be used as data sources for dashboard components.

6. Lock Your Report Filters

In the situation that you do not want your users to be able to change report filters, you can lock the report filters in Lightning Experience, as long as you have permission to edit the report.

 7. Add Colors to Your Dashboard

Finally, in Lightning Experience, you can add color and theme to your dashboard and to each component. You can customize colors in your dashboard by choosing a light or dark theme and a color palette. Of course, you will need to have permission to make use of this feature.

8. Report Type is the Basic

Always think the basic, choose the right report type before creating your report, because you cannot easily change the report type after the report has been created. Report types determine default fields, field labels in report, and available fields on report creation.

9. Extend Your Reports

Rather than continually creating new reports when you just need to change filter values, you can make good use of report parameters. Report parameters are officially supported by Salesforce in Lightning Experience.

10. Subscribe to Your Most Important Reports

Always wondering how your team pipeline is holding up or how far they are from reaching your quarterly targets? Not to worry, because you can subscribe to the report and get it delivered directly to your inbox, for you and your team. With this option, you can monitor your team’s performances without having to manually check into Salesforce.

Get the Book Here

To get more tips and gain a thorough understanding of all the reports and dashboard features in Salesforce, make sure you check out my book on Amazon, available in paperback or Kindle version. A must-have for any Salesforce Admin or Developer.

This blog first published at CloudTech blog.

Salesforce: Report result difference because of user Time Zone setting

A same report run by different person, but produce different result.

1. Record visibility issue (sharing setting)
    negative, because Organization-Wide Defaults is Public read-only
    the user even can open the record not shown in his report.

2. Role Hierarchy filter
    negative, this is not Opportunity report.

The report is filtered with a fix date (not relative date). Date in the record is based on User Time Zone setting, and this date applies to reporting too.

User 1 report

User 2 report

User 1 account

User 2 account

User 1 time zone setting is Singapore (GMT +8), while user 2 time zone setting is PST (GMT -8). If you see in the last 2 screenshots, user 1 see the record is created on 28-Feb-2018, while for user 2, it is created on 27-Feb-2018, this will cause the report have different results run by different users.

Friday, February 23, 2018

Salesforce: Setup Overlay Splits Forecast

This blog is only applicable for Collaborative Forecast, not the old Customizable Forecast.

For revenue split forecast, check out this Setup Forecast with Revenue Split. This blog will share on using Overlay Splits Forecast. To enable Overlay Splits Forecasts, here a few things need to perform:

1. Enable Opportunity Team Selling
Search Opportunity Team Settings and enable Team Selling. You can add the Opportunity Team related list to the page layout.

2. Enable Opportunity Splits
- Search for Opportunity Splits, then click Setting.
- Click "Set up Opportunity Splits" button
- By default "Revenue" and "Overlay" are active, no need to change anything here.
- Click Save button and Enable to confirm.
- You will get an email once Opportunity Splits are enabled.
- Add "Opportunity Splits" related list to the page layout.

3. Enable Forecast
- Search Forecasts Settings
- Select "Enable Forecast"
- Click link "+ Add another forecast type"
- Select "Opportunity Overlay Splits"
- Click OK button and Save button

4. Forecast Tab
Now in the forecast tab, click the gear icon, you should see an option for "Overlay Splits"

Once you have opportunity split by Overlay, you will see the number shown in Forecast when select Overlay Splits.

In Opportunity Related List

In Forecast Tab

ReferenceOverlay Splits Forecasts in Collaborative Forecasts

Wednesday, February 21, 2018

Salesforce: Mass Upload files to Files using Data Loader

Many years ago, I wrote a blog Salesforce: Mass Upload files to Attachment using Data Loader, that blog explains step by step from preparing CSV file and execute from Data Loader to upload file into Salesforce as Attachment.

In the era of Lightning, "attachment" has been replaced by "files", if you are still using the old "Notes & Attachments" related list in Lightning, the file uploaded from Lightning actually is stored as Files, no longer as Attachment.

1. Prepare CSV file
You can use Microsoft Excel to create new CSV file with following columns:
  • Title - this is text that will show as Title of the file. 
  • Description - (optional) description if the file.
  • VersionData - complete file path on your local drive, example: c:\data\test1.docx
  • PathOnClient - complete file path on your local drive, example: c:\data\test1.docx
  • OwnerId - (optional) file owner, if not provided, owner would be to the user uploading the file.
  • FirstPublishLocationId - this can be Account Id for file need to be linked to Account, or Opportunity Id, or User Id, or Library Id (Library Id start with prefix 058).
  • RecordTypeId - if you define record type under "Salesforce Files" setup menu. To check if you have any record type for Files, query this Select Id, Name FROM RecordType WHERE SobjectType = 'ContentVersion'.
  • TagsCsv - (optional) tag.
A sample of CSV file here.

2. Data Loader
With the latest Data Loader application, you can login to Salesforce with OAuth or Password Authentication, make sure to select "Show all Salesforce objects", then look for object "Content Version (ContentVersion)".

Follow the steps, if no error occurred, all the files listed in the CSV file should be loaded to Salesforce as Files. If you are using Lightning but still using Notes & Attachment related list, you will see the file is appeared in Notes & Attachment too, although technically, it is stored as Files, instead of Attachment.


Monday, February 19, 2018

Salesforce: Lightning Experience Adoption Query

So, you are ready to switch to Lightning, but your management decides not to set "Hide Option to Switch to Salesforce Classic" permission. How can you check on how many users have switched to Lightning for good?

Salesforce provides an app you can install from AppExchange Lightning Adoption Tracker, but one of the criteria of this app, that you must enable My Domain.

Once this app installed, you will find a few reports and dashboards added, and a reporting snapshot that needs to be configured, for detail of the steps, see this guide.

Additionally, there are 2 fields added into User object:
“Can Use Lightning”: this custom field stores whether the user has the user permission enabled.
“Using Lightning”: this custom field stores the user preference value.

Can Use Lightning determines how many users have the permission to switch to Lightning, but if you would like to query without installing the package, get it from PermissionSetAssignment object.
SELECT Id, AssigneeId, Assignee.UserName, PermissionSetId, PermissionSet.Name, PermissionSet.IsOwnedByProfile FROM PermissionSetAssignment WHERE PermissionSet.PermissionsLightningExperienceUser = True ORDER BY Assignee.UserName

You need to get unique AssigneeId as this query may report duplicate if the user has more than 1 record permission to enable Lightning. Check this blog Using Permission Set to Query User Permission to learn more about the query on Permission Set.

Using Lightning determines users have switched to Lightning Experience, here is the query from User object without need to install the package
SELECT Id, IsActive, ltnadptn__Can_Use_Lightning__c, ltnadptn__Using_Lightning__c, UserPreferencesLightningExperiencePreferred, Username FROM User ORDER BY Username 

Two fields start with ltnadptn__ are part of Lightning Adoption Tracker packaged installation. Ideally, ltnadptn__Using_Lightning__c and UserPreferencesLightningExperiencePreferred should be the same value, but as ltnadptn__Using_Lightning__c is populated hourly by apex schedule job, so you may see them in sync after an hour.


Thursday, February 8, 2018

Salesforce: Reporting on Relate Contact with Multiple Accounts

More than 1 year ago, we wrote a blog about Relating Contact with Multiple Accounts including the security model to add, edit and remove relationship.

In this blog, we'll share how to report Contacts relate to other Accounts, including if they are direct linkage, active, start date, and custom fields added under  Account Contact Relationships.

1. Create Custom Report Type
- From setup menu: search for Report Types by type in the Quick Find box.
- Click New Custom Report Type button
- Select Primary Object = Contacts, you can enter the Report Type Label, Description, and store it under a Category.
- Click Next button to continue

- In Step 2. Define Report Records Set, click relate to another object.
- Select Account Relationships

- Click Save

2. Create Report
- Type the report type name created in step 1 from Quick Find box
- Click Create button
- Here you will find Direct, Active fields under Account Relationship section at left panel
- Save the report and type a report name
- Run the report

For all contacts where Direct is not ticked, they are added from Relate Account relationship.

Here is the screenshot from one of Sean Lee (one of the contact) that not directly link to Ahui Jack account.

For those of you who more interested in the query using SOQL, here a sample:
SELECT Id, AccountId, ContactId, CreatedById, CreatedDate FROM AccountContactRelation WHERE IsDirect = False

Page-level ad