Calculate actual time spent of a service rep on cases!

A service manager has a requirement to measure the actual time spent per ticket so that, at the end of the month, he can send invoices to his customers. Imagine a situation where the service rep needs to register his actual time spent on a ticket. A ticket comes in through email-to-cases and is routed to a specific queue. But how would you arrange this? I am going to show you one of the ways to fulfill this requirement.

When a case comes in, it registers the opened date/time with a default status and other logic, but that doesn’t mean the service rep has started the process to solve the ticket. The service rep can click on two actions on the case object (renamed to ticket): Starttijd (starttime) and Eindtijd (endtime). Starttijd needs to be clicked when the rep actually starts working on the ticket, and eindtijd when the rep solves the ticket.

Steps:

  1. Create two custom date/time fields: Starttijd (Starttime) and Eindtijd (Endtime)
  2. Create a custom formula number field: Time spent in uren (Time spent in hours): ROUND((Eindtijd__c – Starttijd__c) * 24, 2)
  3. Create 2 screenflows:

  • Add a get records, create a text variable:

  • Update starttijd (starttime); create a formula and fill in DATETIMEVALUE(NOW()) and put that in the update element.

  • The next step is to add the NavigateEverywhereLFA action, download it here: https://unofficialsf.com/navigate-everywhere-flow-action/

  • Then add the reload action (this action refresh the page, you can download it here:
    https://login.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t8d00000024TZ

You might be wondering why I need to use the NavigationToEverywhere action. If you don’t use this and only rely on reload, it will create a loop. Additionally, you should use the reload action; otherwise, the user will see a message indicating that the screenflow is finished, which is not user-friendly in terms of UI.

Do the same for the eindtijd (endtime), and then you can see that the time spent in uren (hours) is calculated automatically.

Sequential approvals based on roles and dynamic criteria using formula fields in Salesforce Approval ProcessesHC Partners B.V.