---
schema_version: "1"
id: 7ed0509f53c56c71b2ed1fec3ff523e4e92b5e8345416019fcce0619c9fb854e
title: Automate Time Sheet Creation, Capture Omni Status Change, and Calculate Shrinkage
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/wem_cookbook_dev_guide/guides/wem-example-timesheet.md
canonical_url: https://developer.salesforce.com/docs/service/wem-cookbook-dev-guide/guide/wem-example-timesheet.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 57dc5bf2755a5d3553e42348453cc2e737e815ed7c57af3bb8f09c7f4978865e
products:
  - Workforce Engagement Developer Guide
  - Service Cloud Developer Content
---

# Automate Time Sheet Creation, Capture Omni Status Change, and Calculate Shrinkage

Set up basic time sheet automation. Log agents' Omni-Channel status changes throughout the day and use that information to calculate the shrinkage percentage within a shift.

- **Ease of Implementation:** Easy
- **Estimated Time to Implement:** 60 minutes

## Prerequisites

This example requires Omni Channel and Workforce Engagement to be turned on.

## Step 1: Create Custom Fields on the Time Sheet Object

Create custom fields on the Time Sheet object in Salesforce to correspond to the data that you use to calculate shrinkage.

1.  From Setup, select **Object Manager**.
2.  In the Quick Find box, enter `Time Sheet`, and then select the **Time Sheet** object.
3.  Select **Fields & Relationships** from the left pane.
4.  To create a field, select **New**.
5.  To create a custom field to hold the data, follow the steps. To learn more about creating custom fields, see [Create Custom Fields](https://help.salesforce.com/articleView?id=adding_fields.htm).
6.  Create these fields.

    ![time sheet with customized fields](https://developer.salesforce.com/docs/media/custom_fields_on_time_sheet.png)

7.  Make sure to add these fields to the layout for testing and deployment.

## Step 2: Create Custom Fields on the Time Sheet Entry Object

Create custom fields on the Time Sheet object in Salesforce to correspond to the data that you use to calculate shrinkage.

1.  From Setup, at the top of the page, select **Object Manager**.
2.  In the Quick Find box, enter `Time Sheet Entry`, and then select the **Time Sheet Entry** object.
3.  Select **Fields & Relationships** from the left pane.
4.  To create a field, select **New**.
5.  To create a custom field to hold the data, follow the steps. To learn more about creating custom fields, see [Create Custom Fields](https://help.salesforce.com/articleView?id=adding_fields.htm).
6.  Create these fields.

    ![Time sheet fields for creation](https://developer.salesforce.com/docs/media/time_sheet_entry_fields.png)

7.  Make sure to add these fields to the layout for testing and deployment.

## Step 3: Introduce Automation Using Salesforce Flow

Two flows are used to allow agents to clock in, generate a Time Sheet, and capture Omni Channel status changes throughout the day.

1.  From Setup, in the Quick Find box, enter `Flows`, and then select **Flows**.
2.  To create your first flow, select **New**.
3.  For more information, see: [Salesforce Flows](https://help.salesforce.com/s/articleView?id=platform.flow.htm&type=5)
4.  Create a screen flow to place on the home page.

    ![Salesforce flow showing automation](https://developer.salesforce.com/docs/media/home_page_flow_1.png)

    ![Automation flow with shift times and records](https://developer.salesforce.com/docs/media/home_page_flow_2.png)

5.  Create a record-triggered flow to capture an Omni status change.

    ![Record-triggered flow to capture Omni status](https://developer.salesforce.com/docs/media/omni_status_change_flow_1.png)

    ![Flow with entries for decisions and status](https://developer.salesforce.com/docs/media/omni_status_change_flow_2.png)

## Test This Example

1.  Clock in using the screen flow.
2.  To simulate the changes in agent availability, change Omni statuses between different presences.
3.  Verify that time sheet entries are created and shrinkage is calculated.
