Pages

Monday, April 25, 2022

Salesforce: Send List Email (2)

This is to continue Salesforce: Send List Email blog written 19 months ago.

Task
As per the EmailMessage blog, every email sent out will also create Task, the same for emails send from Send List Email in list view, it will create a Task too, but a bit different. Let us query the Tasks created.


From the above screenshot:
1st row is manual sending email from the Contact record
2nd row is using send list email from the Contact list view

Subject
1st row - Subject start with Email:
2nd row - Subject start with List Email:


Related To (or WhatId in API)
1st row - WhatId is blank
2nd row - WhatId starts with 0XB


Comments (or Description in API)
1st row - contain: To, CC, BCC, Subject, and Body of email
2nd row - blank


Bonus:
If you do not see the Send List Email button in the Lead or Contact list view, check this:

1. Make sure Send List Email is selected in the List View Button Layout in Contact or Lead object setup, it used to be called Search layouts for Salesforce Classic prior Summer '22 release. 

2. Make sure the users have Allow sending of List Emails permission. However, if you remove Mass Email permission, this permission will be auto removed too, and re-enable back the Mass Email permission will not auto-enable Allow sending of List Emails permission.


Thursday, April 21, 2022

Salesforce: Case Lifecycle report type

Case Lifecycle report is a standard Salesforce report type provided, but probably the one that is not so famous, not many people use, a bit confusing and very less official article about this.

What is the Case Lifecycle report?
Run case lifecycle reports to view the results of the Range field, which indicates the length of time since the case last changed status or owner. Each time the status or owner changes, the counter begins again at zero --- copy from Using Custom Report Types to Report on Support Activity.

Here are a few in the trailblazer community throughout the years:

Ideas related to this in IdeaExchange:
From all the above documents and conversations that can be found using Google search, nothing really explained how Case Lifecycle report works?


What is the Case Lifecycle report?
It is a standard report type that tracks the duration of a case when the case owner or status is changed.

There are 5 fields available in the Case Lifecycle report:
  • Case History Owner
  • Case History Status
  • Case History Last Modified By
  • Case History Last Modified Date
  • Duration

Let us walk through this report type with samples:

1. New Case creation
Remember, every time the case owner or status is changed, a new entry will be created for the case lifecycle report, so creating a new case will generate a new entry for the lifecycle report.

The below report is using minutes unit.


After 2 minutes, let us refresh the report, both the duration and age increase by 2 minutes



2. Change the Case owner
As mentioned earlier, changing the case owner will create a new entry to the lifecycle report.


- 1st row: duration at 7.9 minutes, the case owned by 'Johan Dev501' for 7.9 minutes, before hand over to the new owner.
- 2nd row: duration at 1.083 minutes, the latest duration since it was assigned to a new owner and it has been held for 1.083 minutes  

Let us refresh the report without changing anything on the case


- 1st row: no change, this is completed, the duration will no longer be changed
- 2nd row: now the duration change to 5.1 seconds
 

3. Change the Case owner
Changing the case owner will create a new entry to the lifecycle report.


- 2nd row: this is completed, the duration will no longer be changed
- 3rd row: the duration start for the new owner


4. Change Status
Changing the case status will create a new entry to the lifecycle report.


- Case History Last Modified By, show who change the status or owner
- Case History Last Modified Date, show when does the change happen 
- Case History Owner, show the owner when the entry is created 
- Case History Status, show the status when the entry is created
- Notice that Age keeps counting from the beginning, this is because the case is still open


5. Closing the case
Changing the case status will create a new entry to the lifecycle report.


Let us refresh the report without changing anything on the case

- Notice that the age stops at 26 minutes because the case has been closed
- But, the duration on the last entry keep counting, no matter the case status  


6. Re-open the case
Changing the case status will create a new entry to the lifecycle report.


- Age recalculate again from the beginning
- Duration of the initial Closed entry stopped at 4.033 minutes


7. Re-closing the case


After a few minutes or hours or days, refreshing the report will not change anything, except the duration for the last items, which will keep counting.



Can this report type be customized? 
Such as using a custom field instead of standard status and owner? unfortunately not, see the above list of idea exchanges. Can we only track the owner only or status only? unfortunately also not.

Can we get the data with SOQL? 
The closest we can get is by query to the CaseHistory object, but without duration and age. 
SELECT Id,CaseId,CreatedBy.Name,CreatedDate,Field,OldValue,NewValue FROM CaseHistory WHERE CaseId = '5000I00002FBKqF' AND Field IN ('Owner','Status') ORDER BY CreatedDate


Note: owner will show double, as Id and Name, so you just need to get one as needed.


If you have anything to add for the Case Lifecycle report type, please comment on this blog.




Tuesday, April 19, 2022

Salesforce: Getting Started with Salesforce Flow

Dreamforce 21 announced that Flow is the future of Salesforce, it will replace Workflow and Process Builder and is also friendly for admin without coding background. The flow itself is not something new but it has been added with many features recently, at least can do all workflow and process builder can do.

Here is the business use case: ABC Inc. would like to have a simple "quick create" form that allows users to easily give feedback or idea to enhance the system, from anywhere in Salesforce Lightning, does anyone still in Classic ⚡

Solution: Screen Flow

1. Create a custom object to capture the data

  • Create all the fields needed
  • Add a custom tab if needed
  • Enable the object for reporting, allow activities, track field changes, and allow search
  • Set the object permission by profiles, and fields level security 

2. Create screen flow

Add 3 elements in the flow: screen for form, create records, screen for thank you 


Main screen element, nothing fancy here, just add the input type and set it as required, for this example, type values are derived from a picklist field and set as Picklist Choice Set. You can add emojis to make it fun ðŸ˜Š


Picklist Choice Set gets values from the Type__c custom field.



Create Records element, this is pretty simple, just map each screen component as a value to a field of the object, and remember to select "Use separate resources, and literal values".


** You can add a fault path, in case the system is unable to save the record, such as because of validation rules or etc.


Thank You screen element, the purpose of this screen is simply to tell the user that the data has been captured. In this sample, I will hide the button at the footer.



You can try to debug or run the flow to make sure it will run correctly.

3. Add Flow to Utility Bar

Few items to note here:
  • The flow must be activated
  • Only Screen Flow will be available 
  • Users must have "Flow User" enabled in the user detail, otherwise, the user will not see the flow in the utility item

There is really nothing to be configured here, it is just standard items such as label, icon, panel width, panel height, and of course, the most important is to select the correct flow.

Done and the form looks pretty nice and fits into the utility bar.










Wednesday, April 13, 2022

Salesforce: Subscribe Report

Almost 5 years ago, I wrote about Subscribe report in Classic and Lightning, but now in 2022, everyone has migrated to Classic (or at least 90%). 

Here are a few items related to Subscribe report:

1. As of Spring 22, the max report to subscribe is 7

Check out this idea exchange, but if someone adds you as a recipient for a report subscription, it does not count for the limit.


2. Add other users to receive the report

The report must be not stored in the Private Reports folder, and the recipient must have access to the report folder.


3. Find all reports that you subscribed to

All reports that you subscribed to will have a checkmark in the Subscribed column (Pro tip: you can sort by this column too). But, if you are added by someone, there will be no checkmark on that column. 


You will see in the email user who adds you subscribe to the report.


4. You can set the Run Report As someone else or as yourself

If there are many people added as recipients, the report will run as a user, whether the one subscribes to the report or a recipient. But what does this mean? 

  • Everyone will receive the same report result
  • No matter each user's access to the report, it will be based on the visibility of the user set as the run report
  • If the report is filtered with date, the data will be based on the time zone of the running user set in SFDC, e.g. created date = 1-Jan-2022 and running user timezone is Singapore, the user sees 200 records when running the report, the same number of records will be delivered in email for all users, but other users where timezone set to EST run the same report, that user may see 201 or 199 records, this is because based on that user timezone. SOQL sample: SELECT Id, Name, CreatedDate FROM Opportunity WHERE CreatedDate >= 2022-04-12T00:00:00+08:00 AND CreatedDate < 2022-04-13T00:00:00+08:00 ORDER BY CreatedDate

Bonus: Standard fields with type = date/time, such as Created Date and Last Modified Date will only show the date portion without time information, but if you sort the report based on this field (ascending or descending), the sort order will include time information, even all date is the same.




Page-level ad