Pages

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 the 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 uses 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 changed 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 changed 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 keeps 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, 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? 
Can we use a custom field instead of standard status and owner? Unfortunately, not; see the above list of idea exchanges. Can we track only the owner or status? Unfortunately, also not.

Can we get the data with SOQL? 
The closest we can get is by query to the CaseHistory object but the result will not have 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: The owner will show double, as ID and Name, so you just need to get one as needed.
For the owner with Name, the DataType field = Text, while for the owner with Id, the DataType field = EntityId


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




No comments:

Post a Comment