Pages

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?

Activities
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.



Chatter
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.

Notes:
  • 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.



Reference:

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.

Page202020192018change*
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)
3. Salesforce: 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%



Wednesday, December 23, 2020

Salesforce: Using Macro

Macro is another productive tool for Salesforce users when working with repetitive tasks, such as send an email with the same content, create a task and etc. It works for both Console or Standard Lightning app but on Desktop only. Here is the step to enable and set up macros in Lightning. 


Enable share and organize macros in folders

Go to the setup menu and enable "Share and organize macros in folders" in Macro Settings.

Go to Setup | Object Manager | Macro | Page Layout. Edit it, and add the "Folder" field on the layout


Go to Macros tab (not in setup)

  • Create folder
  • Share the folder to Users, Roles, or Public Groups


Permission

  • To view macros: Read on macros object
  • To create and edit macros: Create AND Edit on macros object
  • To run irreversible macros: "Manage Macros Users Can't Undo" permission


Utility Bar

  • Make sure the user profile has been enabled for the app
  • Add Macros in the Utility Item


Create Macro

  • Open a record of an object, such as Case, Lead, Contact, etc.
  • Click + icon or "Create Macro" button
  • Enter Name, Description, Apply To, and Folder then Save
  • Click Edit Instructions to open Macro Builder
  • On canvas, select an action such as Log a Call, Send Email, etc.
  • Click Save when done


    * Optionally, you can leave the Submit button, so the user can manually save the task populated.

Run Macro

  • Open a record
  • Click Macros in Utility Bar
  • Select a macro
  • Click "Run Macro", the Description when we entered when creating macro will be shown here.


    For governance, your user should not see the "Edit" link in nabove screenshot.
    

Page-level ad