Auto-generate time cards

As an admin, you can configure a scheduled job to generate time cards automatically for project tasks assigned to 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. A job can be scheduled to run every week, for example, on every Sunday to generate time sheets for all users for the next week. You can configure when to run the scheduled job based on the business process of the organization. By default, the scheduled job is turned off. For more information, see Schedule a script execution.

Procedure

  1. Navigate to System Definition > Scheduled Jobs.
  2. In the Scheduled Jobs list, select Auto Generate Time Cards.
  3. 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 Generate time cards for top task only field on the project form level that the time cards for project tasks are created at. If it is set to true, all the time cards for the planned tasks are generated for the top task only i.e. at the project level. If it is set to false, separate time cards are created corresponding to each planned task in the project.

Example

The following example script is executed when a scheduled job is run to generate time cards for the Current week for the Database and Hardware 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);