Pages

Friday, February 23, 2018

Salesforce: Setup Overlay Splits Forecasts

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

See this blog for Setup Forecast with Revenue Split, this blog will share on using Overlay Splits. To enable Overlay Splits Forecasts, here 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 forecast tab, click gear icon, you should see option for "Overlay Splits"



Once you have opportunity split by Overlay, you will see the number show 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.




Reference:


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.


Reference:


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



Monday, January 22, 2018

Implementing Custom Permission for Workflow and Process Builder

More than 3 years ago, we wrote a blog on implementing Custom Permission for Validation Rules. In this blog, we are going to share the same Custom Permission, but for automation, including Workflow and Process Builder.

We'll not discuss further on how to create Custom Permission and Permission Set, so please check the blog mentioned earlier if you need a reference to create Custom Permission and Permission Set.

Workflow
From Workflow Rule Criteria, select formula evaluates to true.
If you have Custom Permission created, you will see $Permission > under Insert Field.



In this sample, I have a Custom Permission name "Edit_Customer_Custom_Permission", select that permission and add it to Rule Criteria $Permission.Edit_Customer_Custom_Permission.



With this criteria, only users assigned to the Permission Set will trigger the workflow, otherwise, the workflow will not be fired.

Process Builder
Let's use the same Custom Permission - Edit_Customer_Custom_Permission. From Criteria - "Define Criteria for this Action Group"
1. Select Formula evaluates to true.
2. In the Build Formula panel, click System Variable.


3. Select Permission >


4. Type or select the Custom Permission, click Choose button.



5. Now you have the formula built $Permission.Edit_Customer_Custom_Permission.



This is the same criteria with Workflow criteria's above.


ReferenceCustom Permission for Validation Rule



Thursday, January 18, 2018

Salesforce: Recycle Bin in Lightning

As of Spring '18 release, Recycle Bin is still not exist Lightning, vote my idea Lightning Experience - Recycle Bin to get this delivered in coming release.

However, if Recycle Bin is a must, and you can't wait if they will be made available in the future release, here is the workaround.

1. Access to page /search/UndeletePage
If your Lightning URL is https://ap1.lightning.force.com/one/one.app#/home change this to https://ap1.lightning.force.com/search/UndeletePage

Once you access the page, you will see Recycle Bin as in Classic. Note, this is only applicable to users allowed to switch back to Classic. When you finish and click any tab or record, it will bring you back to Lighting.

2. Add to Lightning Component
It would be troublesome to communicate to all users to bookmark that page.
Adding the "Recycle Bin" link to a page will be much easier, including for training and writing manual guide.
With a simple Lightning Page editing, add a Rich Text component, in my case, I add it to the Home page.




Additionally, there is a 3rd app in AppExhange to add Recycle Bin in Lightning https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3000000Dq7VmEAJ


ReferenceLightning Experience - Recycle Bin