Pages

Monday, December 25, 2017

Salesforce: Schedule Action in Process Builder

You may read and see somewhere that Process Builder far superior to Workflow, but for some reason, you don't see the option to schedule action, while everyone says that you can schedule action using Process Builder.

There are even ideas in IdeaExchange asking for more details of the schedule jobs from process builder:
Scheduled actions from Process Builder should appear under Time-Based Workflow
Process Builder: Waiting Flow Interviews: Provide Better Information

But, where is the Schedule Action? Is this something need to be enabled by Salesforce support? Or my Salesforce edition does not support Process Builder? Process Builder available from Professional Edition and above, read here Lightning Process Builder.

only immediate action and no scheduled action option

scheduled action available to be configured

What is the causes in the 1st screenshot we don't see scheduled actions option? To have schedule actions, your process has to meet at least 1 of 2 criteria below:
  • Start the process only when a record is created (1). Select this option when you choose an object for your process, or
  • Start the process when a record is created or edited (2). In addition, select the advanced option to execute actions only when specified changes are made (3) when you add criteria to your process.



I have a blog written last year related to "Do you want to execute the actions only when specified changes are made to the record?", so here is the other usage of that checkbox, using ISNEW() and ISCHANGED() will not enabled scheduled action option.


Reference



Sunday, December 24, 2017

Salesforce Report: Bar Chart with Cumulative Line Chart

In Salesforce reporting (include Lightning), you can use a field only once, if you have admin right, you can create formulas field that returns the same value with the original one, so can use it too in the report.

We have a request to have a chart with opportunity amount in both monthly total and cumulative YTD. Salesforce report has the cumulative option for a line chart, but unfortunately, as mentioned in the first paragraph, we can't use a field more than once in a chart, while to create a formula field for this scenario of dynamic values seems like not possible. The easier option is to export the data and easily built it in Excel, but it would not be stored in the platform.


simple bar chart only shows the total monthly amount



change to line bar chart and enable the Cumulative option


add the new measurement, but only can select different field, in this case, I use Count, plot as line chart and as the second axis.


create new formula field Amount clone, but because the main chart is a bar chart, the Cumulative option is not available for the additional measurement.


Now, let's see how is the data looks like in the report for the last chart:


So, if we can get the cumulative value in the last column, instead of the same value, then we can achieve the report requested.
For row 1, it would be just that row itself.
For row 2, it would be row 2 amount + row 1 amount.
For row 3, it would be row 3 amount + row 2 amount + row 1 amount.

Remember, there is a function called PREVGROUPVAL() in the Custom Summary Formulas for the report. We can use this function for this need. This function calculates values relative to a peer grouping. If there’s no previous grouping, the function returns a null value.

This function returns the value of a specified previous grouping. A “previous” grouping is one that comes before the current grouping in the report. Choose the grouping level and increment. The increment is the number of columns or rows before the current summary. The default is 1; the maximum is 12. You can only use this function in custom summary formulas for reports.

This is the function pattern
PREVGROUPVAL(summary_field, grouping_level [, increment])
From here, see that you can adjust the incremental of previous grouping.

Adding Custom Summary Formula with PREVGROUPVAL() function allow us to get this table



Then we can easily add this chart to the report:



Step by step:
1. From your summary or matrix report, create Custom Summary Formula, in this example, I called it Cumulative Amount.

2. In "Where will this formula be displayed?", select "Grouping 1:".

3. Copy and paste following formula:
AMOUNT:SUM
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,1)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,1), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,2)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,2), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,3)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,3), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,4)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,4), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,5)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,5), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,6)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,6), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,7)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,7), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,8)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,8), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,9)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,9), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,10)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,10), 0)
+
IF(NOT ISBLANK(PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,11)),
PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE,11), 0)


You can adjust the formula as necessary, change AMOUNT:SUM with RowCount if you need to show the number of records instead of Opportunity Amount.
Note: you can use this solution if your report has the maximum grouping of 13, because the maximum incremental for PREVGROUPVAL() is 12.

4. Add Vertical Bar Chart with Y-axis is the main amount, then add measure using Custom Summary Formula created in step 1-3, select Plot as Line Chart.



You also can enable "Plot on Second Axis" to get second Y-axis values for the line chart values.



Reference:



Tuesday, December 19, 2017

Salesforce: How to block Workbench?

Workbench is an unofficial, yet powerful tool for Salesforce admin and developer to perform almost anything related to Salesforce support. In many cases, end user supposed have no access to this tool, although it still honors user permissions assigned in Salesforce. However, can we block the normal users from accessing Workbench?

Yes, in the previous blog, we discussed how to turn off Salesforce1. Using the same method, we can block the normal user from accessing Salesforce from Workbench.

1. Connected Apps
Navigate to Setup | Apps | Connected Apps | Manage Connected Apps, click Edit link on Workbench.
Change the 'Permitted Users' value under 'OAuth policies' to 'Admin approved users are pre-authorized', and click Save.


2. To Give Access
Now, you want specific users able to access Workbench. There are 2 options:

a. Using Profile
All users in the profile will be able to access Workbench.
In the Workbench page under Connected Apps, scroll down to Profiles, click Manage Profiles button. Select all profiles that need to access Workbench, then click Save button.

b. Using Permission Set
Using Permission Set is more flexible, only users assigned with that permission set will be able to access Workbench.
But before configure in Connected Apps, you need to create a permission set without any permissions, then assign users to that Permission Set. Next, in the Workbench page under Connected Apps, scroll down to Permission Sets, click Manage Permission Sets button. Select all permission sets that need to access Workbench, then click Save button.


When a user without permission to access Workbench, the user will see an error message when try to login to Workbench OAUTH_APP_ACCESS_DENIED: user is not admin approved to access this app.




Monday, December 18, 2017

Salesforce Lightning App page not refresh

My experience when configuring Salesforce Lightning App page that related to UI (user interface) is not great, when I add a field in the page layout or adding components into Lightning App, it doesn't reflect immediately when I open a record. In many times, I need to refresh many times, even have to logout and login back. This experience never happens in Classic.

Is this a bug with Lightning Experience? Further checking this issue, I found this basically related to caching that implemented for Lightning Experience.

There is a setting under Setup | Session Settings called Enable secure and persistent browser caching to improve performance.


Once this caching disabled, I do not have that experience/issue anymore. Since this caching will improve user experience overall, so I do not suggest to disable in production, but only in Sandbox when you need to configure the user interface a lot.

From Salesforce documentation, enables secure data caching in the browser to improve page reload performance by avoiding extra round trips to the server. This setting is selected by default for all orgs. We don’t recommend disabling this setting. However, if your company’s policy doesn’t allow browser caching even if the data is encrypted, you can disable it.
We've added secure data caching in the browser to improve page reload performance by avoiding additional round trips to the server.

This feature is available in Lightning Experience only.


Reference:


Wednesday, December 13, 2017

Salesforce Lightning: Utility Bar

One of the benefits when you switching to Lightning is Utility Bar. Lightning Experience allows you to add your components to the prime real estate in any Lightning app so that your users have one-click access to powerful productivity tools, such as Recent items, Notes, Chatter feed and so on. Your users can access those same productivity tools in a horizontal footer, called the utility bar.

Utility bar gives your users quick access to common productivity tools. The utility bar is a fixed footer that opens components in docked panels. You can add multiple components to the utility bar, each Lightning Apps can have their own set of components in the utility bar. You also can add the same components many times in the utility bar within the same Lightning apps, this is because some of the components allowed you to select a different type of visibility, e.g. for Chatter Feed components, you can select Bookmarked, What I Follow, and To Me feed.


Utility bar will be available and visible for the users, no matter which page they are open, so this gives instant access to the components, this is even better compare to Classic, where you can add commonly used items in the Home page.

As of now Winter '18 release, Salesforce provide 13 standard components available for utility bar, but you can develop your owned components (need to enable My Domain) or install from AppExchange.


Reference:



Monday, November 20, 2017

Salesforce: Time field (Beta)

This blog is written with Winter '18 release, where time field still in Beta, let us expect many improvements in Spring '18 release and beyond. This feature is enabled by default in Sandbox, but you need to request Salesforce if you would like to enable it for the production.

This function has been requested in Idea Exchange since 10 years ago, and at this moment it has 5,530 points.

There are 2 types of Time fields in Winter '18 beta:
- as a Custom field with Data Type = Time, or
- as a Formula field with Return type = Time

1. Custom field with Data Type = Time
As of now, the display in Lightning is not great, but much nicer in Classic.


As this is not formula field, users with appropriate permission able to type in the time directly into the page layout.

In Classic, you can enter the time in 24 hours format:
- "18", when you save, this will save as 6:00 PM
- "18:12", when you save, this will save as 6:12 PM
- "7:12", when you save, this will save as 7:12 AM
- "7.32", when you save, this will save as 7:00 AM  --> 18.12 (dot) will be ignored

You also can enter the time in 12 hours format with AM/PM (in Classic):
- "12 AM", when you save, this will save as 12:00 AM
- "12:30PM", when you save, this will save as 12:30 PM

While in Lightning, you need to enter in pattern of HH:MM:SS, example: 07:30:00, or  19:00:00, once stored, it will display as 07:30:00.000Z or 19:00:00.000Z


2. Formula Field return Time
Sample: MINUTE(Approved_Time__c), HOUR(Approved_Time__c)
To calculate hours and minutes between time fields, you cannot just minus or add them directly, Submission_Time__c - Approved_Time__c will return error "Incorrect parameter type for operator '-'".

To display the difference between 2 times, you can use formula field to return the formula as text, example:
IF( (MINUTE(Approved_Time__c) - MINUTE(Submission_Time__c)) >=0,
TEXT((HOUR(Approved_Time__c) - HOUR(Submission_Time__c)))
& ":" &
TEXT((MINUTE(Approved_Time__c) - MINUTE(Submission_Time__c))),
TEXT((HOUR(Approved_Time__c) - HOUR(Submission_Time__c) - 1))
& ":" &
TEXT((MINUTE(Approved_Time__c) - MINUTE(Submission_Time__c) + 60))
)

To read the complete documentation, read this article, and if you have further questions, feel free to join Custom Time Field success community.

Update since Spring '18 release, now you can calculate time field to return Number, example:
End_Time__c - Start_Time__c
This formula will return the time difference in milliseconds; 1 hour = 3,600,000 milliseconds.



Reference:


Saturday, November 18, 2017

Enable Record Type with Permission Set

Back to the basic series - permission set for the record type access.

I had a discussion with a user group member, which is subject matter expert (Salesforce biz owner) in his company. He is using Record Type to differentiate Account Type, where the different type of Account has the different layout. This is a good usage of the record type. But, he also complains his workload because of a special record type that only able create by him as the biz owner, salespeople are not allowed to create this special type of Account, but only able to see.

He would like to give the ability to a sales support user ability to create that special Account type, let's call it "Not-normal" for this blog. But, he also not able to make that sales support user have the same Profile as him.

Solution: use Permission Set
Create a new permission set and assign it to that Sales support.
When you are in the Permission Set, select Object Settings, for the object (in this case is Accounts), you will see Account: Record Type Assignments and enable Not-normal record type.



Then assign the permission set to that sales support user, I'll not discuss how to assign the permission set in this blog, but you just need to click "Manage Assignments" button.






Tuesday, October 3, 2017

Salesforce: Lightning Mass Inline Editing in List View

Many years back, when we are still in Classic, we can enable Mass Inline Editing from the list view, read this blog Inline Editing in Salesforce List View for more info. However, when switching to Lightning, inline editing for list view is not available.

Until Winter '18 release, Salesforce adds this feature in Lightning. I have a use case where the list view works in some object, but not for other objects, example: the checkbox at the left shown in Lead, but not in Opportunity. However, when switching back to Classic, the checkbox appear for Opportunity. For sure, this is not about menu setup issue as it works in Lead objects in Lightning.

Further check, here is the cause, the checkbox at the left for Lightning only appear when A or B scenario below is fulfilled:

A. You can inline edit the list
1. If you have record type configured, the list view should filter with only one record type, and
2. There are fields in the list view which is editable, such as: not created date, created by, etc, and
3. No "OR" filter logic in the list view.

B. Mass action button
You have mass action button added to the list view tab, such as "Add to Campaign" button.
But, keep in mind around, if your custom mass actions buttons are Javascript, they'll show up and work in Classic but will not be visible in Lightning, as there is no mass action for the list view, the checkbox will not appeared too.




Notes: mass inline edit in Lightning is auto enabled since Winter '18 release, and it does NOT need to enable Enable Inline Editing and Enable Enhanced Lists from User Interface setup menu.


ReferenceEdit More Records at Once with Mass Inline Editing



Wednesday, September 27, 2017

Salesforce: Files Visibility and Actions

We shared about Files Sync in the previous blog, where we can have two-ways sync from Salesforce with desktop computers, also ability to "create" folder structure from desktop computers which will be synchronized to Salesforce.

Next question, once I have my file in Salesforce, who can see my Files? Only me? Or someone else in the company will able to see my files?.

Your files in Salesforce can be private to you, privately shared, or visible to your entire company.
Sharing SettingDefinitionWhen Does a File Have This Setting?
Private PrivateThe file is private. It hasn't been shared with anyone else besides the owner. The file owner and users with “Modify All Data” permission can find and view this file. However, if the file is in a private library, only the file owner has access to it.A file is private when you:
  • Upload it in Files home
  • Publish it to your private library
  • Sync a file in your Salesforce Files Sync folder
  • Stop sharing it with everyone (Make Private)
  • Delete posts that include the file and the file isn't shared anywhere else
Privately Shared Privately SharedThe file has only been shared with specific people, groups, or via link. It's not available to all users in your company. Only the file owner, users with “Modify All Data” or “View all Data” permission, and specific file viewers can find and view this file.A file is privately shared when it's:
  • Only shared with specific people or a private group
  • Posted to a private group
  • Shared via link
  • Posted to a feed on a record
  • Published to a shared library
Company-wide Your CompanyAll users in your company can find and view this file.A file is shared with your company when it's posted to a feed that all users can see, a profile, a record, or a public group.

When a file sharing is private, only the file owner (the one who upload the file) and users with Modify All Data permission (this includes your System Administrators) will able to see the file, but not for users with View All Data permission. However, for Privately Shared files, users with "View all Data" permission will be able to see it.

Here actions user can do with the file by file owner, collaborator and viewer:
ActionFile OwnerFile CollaboratorFile Viewer
View or PreviewYesYesYes
DownloadYesYesYes
ShareYesYesYes
Attach a File to a PostYesYesYes
Sync a FileYesYesYes
Upload New VersionYesYes
Edit DetailsYesYes
Change PermissionYesYes
Make a File PrivateYes
Restrict AccessYes
DeleteYes


Make file Private
When you have a file has been shared with many people or groups, you can "restore" it back as private by clicking "Make Private" link from Sharing Settings (unfortunately until Summer '17 release, this only available in Classic, and not in Lightning)



Prevent others from sharing and unsharing
You have files shared to other user or group, Salesforce offers a function not to allow other users to share it. There is a box in file sharing setting called "Prevent others from sharing and unsharing", tick this box to enable it.



Let's see from user experience when accessing the files shared with them, the first one is the default where they are allowed to share with other users, and the second screenshot when the file owner enable the option not allowed to share:

this is normal file shared to another user (2nd file)

when the owner makes the file not shareable (1st file)


File Privacy on Records
Before Winter '18 release, all files on records in Lightning Experience were visible to everyone with access to the record. Winter '18 release introduces "File Privacy on Records" option, when the option selected is "Private on Records" in Lightning Experience and communities, the file will be not visible to all user able to access the record, it will be behavior as Private sharing file.

Only file owners and administrators have the power to change the value of File Privacy on Records.
A file marked as private in Lightning Experience is also private in Salesforce Classic. Admin needs to add File Privacy on Records field into Content Version object page layout in the Setup menu.



Reference:


Tuesday, September 26, 2017

Salesforce: Files Sync

Salesforce Files Sync lets you store your documents in the cloud and access them from any device: your computer, laptop, phone or iPad. You'll never again have to wonder where you left the current version - anywhere you access the file it will be up to date!

Files Sync is a desktop agent to sync files and folders from your computer with Salesforce Files. This is pretty similar to other providers such as Dropbox, Microsoft OneDrive, Box, and etc, where you can sync files and access it from anywhere, any devices, but also from Salesforce.

Here are few benefits using Files Sync:
- The files are stored in Salesforce platform
- The files are accessible from Salesforce1 mobile, and computers with sync agent installed
- No additional cost, it comes along with your Salesforce license
- 10 GB storage for each user
- Create folder and subfolders from desktop (computer)
- You can choose files in Salesforce to be synced, so not all Files will be synced by default.

I have a unique case, this company is blocking file hosting service, including their sync agent software, such as Dropbox, OneDrive and etc. However, Salesforce is a legitimate application used by the company, so Files Sync is the only one will work for syncing files.


Here are few steps to configure Files Sync:

1. Enable Files Sync
From Setup | Feature Settings | Salesforce Files | General Settings, select Enable Files Sync.


Once this enabled, you should see Sync Files permission under Profile or Permission Set.


2. Grant Users Access
The Sync Files permission need to assign to users, this can be done through Profile or Permission Set.


3. Install Salesforce Files Sync
The user needs to install Files Sync agent to their computer. Download the installer from personal settings, enter Files Sync in the Quick Find box, then select Salesforce Files Sync. Available for both Windows and Mac OS X.


Follow the installation instructions for your operating system, then log in with your Salesforce credentials.


4. File Upload and Download Security (Optional)
From Setup, enter File Upload and Download Security in the Quick Find box, then select File Upload and Download Security.

This is to control how various file types are handled during upload and download. Select Don't allow HTML uploads as attachments or document records" to prevent users from uploading files that can pose a security risk.



Notes:
1. When the user has Sync Files permission enabled and desktop agent installed and log in, she or he will see additional column Sync in Classic, this is not available yet in Lightning (Summer '17 release).

before

after


2. Additional "Synced" menu is added to the menu under Files tab.



3. The user can sync file from Salesforce by clicking sync icon next to the file, this is not available yet in Lightning (Summer '17 release).



4. When sync agent in the desktop is working properly, the icon in taskbar should be the blue-white cloud with checked. If it is in blue-black cloud, something is wrong, either the user does not have permission for Files Sync, or the Org. has not been enabled for Files Sync. Right-click the icon and select "Sync Status..." for more information.

working properly 

something wrong


5. When you overwrite the file in a computer which syncs to Salesforce, the file version history is maintained by Salesforce, you can retrieve the older versions from Content details page.



Reference:


Sunday, September 10, 2017

Salesforce: Mass Upload Products

Almost two years ago, we wrote a blog related to Product in Salesforce, continue with another blog to assign Product to Price Book, and on adding Product to Opportunity.

In this blog, we will share about step by step to add Product to existing Price Book.

1. Add New Product 
From Lightning, select Products tab. If you do not see Product tab, use following URL and parameters: one/one.app?source=aloha#/sObject/Product2/list?filterName=Recent
Enter all information for product and make sure Active is ticked.



2. Add Product to Standard Price Book
  • Open the product created. 
  • Click Related tab.
  • Looks for Price Book, then click "Add Standard Price" button. By default, Standard Price Book is selected. In many cases, we do not use Standard Price Book, so you may just select other price books at this window, but you will get error message No standard price defined for this product, this is because we need to have the standard price for the product, even we do not use it.
  • Select Standard Price Book, if you have multi-currency enabled, make sure to select correct Currency, also make sure Active is ticked.
  • Click Save button.


3. Add Product to real Price Book
  • From the screenshot in step 2, once Standard Price Book is added, you will see 'Add to Price Book' button. 
  • Select the Price Book and Currency.
  • If you need to add into multiple currencies, you need to repeat step 2 above multiple times.
  • Enter the List Price of the Product for that Price Book.
  • Click Save button.


Mass Upload Products
If you need to load many products, manual steps as above are not efficient. The solution is the use Data Loader to mass load the products and assigned to the relevant price book. 

The step using Data Loader are similars with manual steps as above:
1. Load products to Product2 object.
2. Assign product to Standard Price Book, get Standard PriceBookId for PricebookEntry object.
3. Assign product to real Price Book, get the real PriceBookId for PricebookEntry object.



Reference:



Page-level ad