Loading
Asset Service Lifecycle Management
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Set up Automatic Time Sheet Validation

          Set up Automatic Time Sheet Validation

          Set up the expression set and records that are used to automatically validate a timesheet submitted by the technician. Automatically create the time sheet entry items and time sheet wage type summaries associated with the submitted timesheet.

          Required Editions

          Available in: Lightning Experience
          Available in: All editions of Field Service Plus for Energy and Utilities, and all editions of Asset Service Lifecycle Management
          User Permissions Needed
          To access flow templates Labor Cost Optimization Admin

          Use a flow template available in Timesheets and Labor Cost Optimization to automatically validate submitted timesheets. Clone and activate the flow template, create pay type records, expression sets, and service resource cost role records.

          Flow Template Name Usage Flow Template Description
          Process Timesheet Mobile and Desktop

          Processes and validates the timesheet.

          Used when the Time Sheet status is submitted. Triggers the Invocable action (Validate Time Sheet) to validate the Time Sheet Entries and creates Time Sheet Entry Items and Time Sheet Wage Type Summary.

          Invocable Action Name Related Flow Invocable Action Description
          Validate Time Sheet Process Timesheet Flow
          • Executes Service Resource Cost Rule of type "Timesheet Entry Item Calculation" to create Time Sheet Entry Item records. Rules can have BRE expressions or Apex Classes or both (ServiceResourceCostRule.Rule or ServiceResourceCostRule.ApexClass)
          • Calculates Wage Type Summary using the created Time Sheet Entry Items
          • Executes Service Resource Cost Rule of type 'Timesheet Validations' to create Time Sheet Validation records. Rules can have BRE expressions or Apex Classes or both (ServiceResourceCostRule.Rule or ServiceResourceCostRule.ApexClass)
          • Updates the Time Sheet and Time Sheet Entries status to Approval Pending.
          • In case of validation failure (such as overlaps in time sheet entries and gaps between time sheet entries)
            • Time Sheet Entry Items and Wage Type Summary are still calculated, and the status of invalid Time Sheet and/or Time Sheet Entry is set to Error.
            • Time Sheet Validation error records are in a related list to Time Sheet and Time Sheet Entry

          After a timesheet is submitted, the Process Timesheet flow validates the time sheet record with Business Rules Engine. The expression set also validates the service resource cost rule and pay type records associated with time sheet entries.

          Use the Service Resource Cost Rule record to define rules to validate time sheets. You can use either an Expression Set or an Apex Class to validate the time sheet. Alternatively, you can build an Apex Class to provide data to the Expression Set, which then validates the time sheet. To do this, enter the API names of the Apex Class and the Expression Set in the Service Resource Cost Rule record.

          Expression Set Template BRE Expression Set Description
          Timesheet Entry Item Computation Rule

          This rule is used to create Time Sheet Entry Item records for the Time Sheet Entries. It uses Service Resource's Operating Hours Timeslots to calculate the PayTypes. If the service resource doesn't have the operating hours (Service Territory Member's Operating Hours is null), then it considers the Service Territory's operating hours.

          To configure a custom validation rule that is executed when a timesheet is submitted, create a Service Resource Cost Rule record with type Timesheet Validations.

          1. Clone the flow builder templates available with Timesheets and Labor Cost Optimization. You must create at least one flow from each of the templates listed earlier.
            1. From Setup, find and select Flows under Process Automation.
            2. Click the flow template that you want to clone. For example, click Process Approved TimeSheet.
            3. Click Save As on the header of the flow builder and enter a flow label and a flow API name.
            4. Save your changes
            5. To activate the flow, click Activate.
          2. Create pay type records for Regular Time, Over Time, Double Time, Vacation Pay, and set their associated Wage Types.
            Pay type records are used in the Process Timesheet flow to automatically associate labor costs to a timesheet entry.
            1. From the App Launcher, find and select Pay Types .
            2. Click New.
            3. Set the Effective Start Date to any date in the past.
            4. Select Active.
            5. Enter a name. For example, enter Regular Time.
            6. Select a wage type. For example, Regular Type.
            7. Save your changes.
            8. Repeat these steps until you create all available pay type records.
          3. Create an expression set from Timesheet Entry Item Computation Rule template.
            1. From the App Launcher, find and select Expression Set Templates.
            2. Click Timesheet Entry Item Computation Rule template.
            3. In Expression Set Properties, in Rank, enter 1.
              When more than one enabled version matches an expression set call, and the datetime periods overlap, the version with the highest rank is chosen. For example, if two enabled versions have rank values set to 1 and 2, the version with rank 2 is chosen.
            4. Save and activate the expression set.
          4. Create an expression set from Timesheet Vehicle Validation Rule template.
            1. From the App Launcher, find and select Expression Set Templates.
            2. Click Timesheet Vehicle Validation Rule template.
            3. In Expression Set Properties, in Rank, enter 1.
              When more than one enabled version matches an expression set call, and the datetime periods overlap, the version with the highest rank is chosen. For example, if two enabled versions have rank values set to 1 and 2, the version with rank 2 is chosen.
            4. Save and activate the expression set.
          5. To use either expression sets or Apex classes to validate time sheet records, set the Rule field in the service resource cost rule page as an optional field.
            1. From the object management settings for Service Resource Cost Rule, go to Page Layout.
            2. Under Service Resource Cost Rule Detail, for the Rule field, click Properties.
            3. To set Rule as an optional field, deselect Required .
            4. Save your changes.
          6. Create a service resource cost rule record.
            The service resource cost rule record is used in the Process Timesheet flow to automatically associate pay types with timesheet entry items.
            1. From the App Launcher, find and select Service Resource Cost Rule.
            2. Click New.
            3. Enter a name, for example, Timesheet Entry Item Computation.
            4. In Rule, enter the API name of the expression set or the Apex class that you want to use to compute time sheet entry items for the time sheet. For example, TimesheetEntryItemComputationRule.
            5. To prepare the data for the Business Rules Engine Expression Set, enter an either an Apex Class or a Standard Apex Class. For example, select ifstmsht.TimeSheetEntryItemRuleDataHandler for Standard Apex Class.
            6. Select a labor union.
            7. Activate the rule.
            8. For Type, select Timesheet Entry Item Calculation, and save your changes.
          7. Create a service resource cost rule record.
            The service resource cost rule record is used in the Process Timesheet flow to create Time Sheet Validation Errors if necessary for labor union compliance.
            1. From the App Launcher, find and select Service Resource Cost Rule.
            2. Click New.
            3. Enter a name, for example, Vehicle Validation Rule.
            4. In Rule, enter the API name of the expression set or the Apex class that you want to use to compute time sheet entry items for the time sheet. For example, TimesheetVehicleValidationRule.
            5. Select a labor union.
            6. Activate the rule.
            7. For Type, select Timesheet Validations, and save your changes.
           
          Loading
          Salesforce Help | Article