Auto-generate time cards

Admin can configure a scheduled job to generate the time cards automatically for project tasks assigned to the time card users.

Before you begin

Role required: admin

About this task

In addition to the manual option Generate Time Cards, a scheduled job can be run to automatically generate the time cards for project tasks. It can be scheduled to run every week, for example, on every Sunday to generate time sheets for all user for the next week. The admin can configure when to run the scheduled job based on the business process of the organization. By default, the scheduled job is turned off.
Note: The scheduled job auto-generates time cards only for those users who have Auto create time cards every week set to true in their assigned time sheet policy.

Procedure

  1. Navigate to System Definition > Scheduled Jobs > Auto Generate Time Cards.
  2. Configure the following parameters in the script as per the business requirements:
    • run for (CURRENT_WEEK, NEXT_WEEK, LAST_WEEK)
    • Group Name (includeGroups, excludeGroups)
    Note:
    • If a time card exists for a project task for the time card week, a duplicate time card is not created.
    • Time cards are generated only for those project tasks that are in progress or planned in that week.
    • The Allow time card reporting on field on the project form determines the level at which the time cards for the project tasks are created.

Example

The following is an example script which is executed when a scheduled job is run for generating time cards for the Current week for Database and Hadware groups:

// Clone this schedule job to run separately for different groups at different times
// One of the following values
// TimeCardConstants.CURRENT_WEEK
// TimeCardConstants.NEXT_WEEK
// TimeCardConstants.LAST_WEEK
var runFor = TimeCardConstants.CURRENT_WEEK;

// Comma separated group sys ids or group names. TimeSheet/TimeCards will be auto generated for time card users in the given groups.
var includeGroups = [Database,Hardware];
var excludeGroups = [];

var generator = new TimeCardGenerator();
generator.generateFromConfig(runFor, includeGroups, excludeGroups);