Skip to main content
Planview Customer Success Center

GetSumOfTimesheetReportHoursForFixedPeriod Function

GetSumOfTimesheetReportHoursForFixedPeriod (user as ObjectIdentifier, period as String, state1 as ObjectIdentifier, state2 as ObjectIdentifier, ... as ObjectIdentifier) as Duration

Category: Date
Description: Returns the the sum total duration of reported timesheets for the specified user. Where the "user" argument can be a specific user or a reference to user field, and the "period" is either "m" for current month, "w" for current week, or "d" for current day. The "state" argument is optional and by default will return reported hours for timesheets in all states.
Supported Context: BusinessRules
Parameters:  
user as ObjectIdentifier(User) Represents a reference to a user object or a field that returns a user object
period as String Represents the frame of time for which you would like to know the total reported hours. Value can be either "d", "w", "m" corresponding to day, week, month, quarter, or year
state1 as ObjectIdentifier(State)

An optional parameter that represents the state of work items for which you would like to get reported hours, this parameter can be repeated for each work item state, or left as null for work items in state "draft" and "active"

  • Active
  • Cancelled
  • Completed
  • Draft
  • On Hold
state2 as ObjectIdentifier(State)

An optional parameter that represents the state of work items for which you would like to get reported hours, this parameter can be repeated for each work item state

  • Active
  • Cancelled
  • Completed
  • Draft
  • On Hold
... as ObjectIdentifier(State)

An optional parameter that represents the state of work items for which you would like to get reported hours, this parameter can be repeated for each work item state

  • Active
  • Cancelled
  • Completed
  • Draft
  • On Hold
Returned value as Duration Returns a duration value equal to the total number of reported hours for the user specified in the "user" parameter for the given "period" for the work items in the given states specified in the "statex" parameters
Example #1

Create a custom field on the User entity that will calculate the total timesheet hours reported for the current week. This will show both the user and the managers to view total reported hours. To implement this first create a custom field on a user of type 'duration', and set it to be updated by the API. Next create a workflow rule on the Timesheet entity taht will run every time a record is created or edited. In the Set Actions section, select the 'Update Field' action, adn then find the custom field you created by first clicking on the 'Reported By Fields' option. Now enter the following:

GetSumOfTimesheetReportHoursForFixedPeriod(currentuser(),"w")

This formula can also be changed to track the reported timesheet hours for a given month or day or for the timesheets that have been approved.

Tips This function has a parameter from type pick list that may have being customized by your organization. Please refer to the pick list values in the formula helper editor or view the values within the relevant field.