Timesheet Examples

Query by Date Range

Query all the timesheets, including timesheet rows and cells, that overlap with a date range.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByDateRange",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 8,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 8,
        "Day": 30
      }
    ],
    "Load": [
      {
        "Relationship": "TimeRows",
        "Load": [
          {
            "Relationship": "Activity"
          },
          {
            "Relationship": "Cells"
          }
        ]
      }
    ]
  }
]

Create / Query by User and Date

Query the timesheet for a given user that contains a specific date. This query will also automatically create the timesheet (with the appropriate timesheet period) if it has never been opened before. This is currently the only way to create a timesheet through the remote API.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByUserDate",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "45"
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 8,
        "Day": 5
      }
    ],
    "Load": [
      {
        "Relationship": "TimeRows",
        "Load": [
          {
            "Relationship": "Activity"
          },
          {
            "Relationship": "Cells"
          }
        ]
      }
    ]
  }
]

Create / Query by User and Date

Query the timesheet for a given user that contains a specific date. This query will also automatically create the timesheet (with the appropriate timesheet period) if it has never been opened before. This is currently the only way to create a timesheet through the remote API.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByUserDate",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "45"
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 8,
        "Day": 5
      }
    ],
    "Load": [
      {
        "Relationship": "TimeRows",
        "DomainType": "Replicon.Project.Domain.Timesheets.TimesheetTaskRow",
        "Load": [
          {
            "Relationship": "Activity"
          },
          {
            "Relationship": "Cells"
          },
          {
            "Relationship": "Task"
          },
          {
            "Relationship": "Client"
          }
        ]
      }
    ]
  }
]

Query by User and Date Range

Query timesheets for a user that overlap with a given date range. This example specifies past and future, so it loads all timesheets for a user.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByUserDateRange",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "45"
      },
      {
        "__type": "Date",
        "Past": true
      },
      {
        "__type": "Date",
        "Future": true
      }
    ],
    "Load": [
      {
        "Relationship": "TimeRows",
        "Load": [
          {
            "Relationship": "Activity"
          },
          {
            "Relationship": "Cells"
          }
        ]
      }
    ]
  }
]

Query Timesheet by UDF Value

Query for timesheets by a user defined field value.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetsEqualToUDFValue",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      "Region",
      2
    ]
  }
]

Query Timesheet by Null UDF Value

Query for timesheets by an empty user defined field value.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetsNullUDFValue",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      "Exported"
    ]
  }
]

Query Timesheet By Arguments

Query for timesheets for the specific user with timesheet entries for the dates specified, that have been saved, and have an Open approval status and that have the timesheet level user defined field value. This is a special multi-argument query that can accept null for any argument, allowing you to define arguments for which the query should not be restricted.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByArguments",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      },
      null,
      null,
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 9,
        "Day": 1
      },
      {
        "__type": "Date",
        "Year": 2010,
        "Month": 9,
        "Day": 30
      },
      true,
      {
        "__type": "Replicon.Domain.Approvals.ApprovalStatus",
        "Identity": "Open"
      },
      null,
      null,
      [
        "City",
        "Calgary"
      ],
      [],
      []
    ]
  }
]

Add Timesheet Row with Billing by Project Rate

Add a timesheet row that billing is by project rate to an existing timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "46",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Task": {
              "__type": "Replicon.Project.Domain.Task",
              "Identity": "8"
            },
            "Client": {
              "__type": "Replicon.Project.Domain.Client",
              "Identity": "2"
            }
          },
          {
            "__operation": "SetTaskRowBilling",
            "BillingType": {
              "__type": "Replicon.Project.Domain.Timesheets.TimesheetBillingType",
              "Identity": "ProjectRate"
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      }
    ]
  }
]

Add Timesheet Row with Billing by User Rate

Add a timesheet row that specifies billing is by user rate to an existing timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "46",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Task": {
              "__type": "Replicon.Project.Domain.Task",
              "Identity": "8"
            },
            "Client": {
              "__type": "Replicon.Project.Domain.Client",
              "Identity": "2"
            }
          },
          {
            "__operation": "SetTaskRowBilling",
            "BillingType": {
              "__type": "Replicon.Project.Domain.Timesheets.TimesheetBillingType",
              "Identity": "UserOverrideRate"
            },
            "User": {
              "__type": "Replicon.Domain.User",
              "Identity": "2"
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      }
    ]
  }
]

Add Timesheet Row with Billing by Project Role

Add a timesheet row that specifies that billling is at a project role rate to an existing timesheet

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "46",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Task": {
              "__type": "Replicon.Project.Domain.Task",
              "Identity": "8"
            },
            "Client": {
              "__type": "Replicon.Project.Domain.Client",
              "Identity": "2"
            }
          },
          {
            "__operation": "SetTaskRowBilling",
            "BillingType": {
              "__type": "Replicon.Project.Domain.Timesheets.TimesheetBillingType",
              "Identity": "RoleRate"
            },
            "ProjectRole": {
              "__type": "Replicon.Project.Domain.ProjectRole",
              "Identity": "2"
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      }
    ]
  }
]

Add Timesheet Row with Billing by Department

Add a timesheet row that specifies that billing is at a department rate to an existing timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "46",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Task": {
              "__type": "Replicon.Project.Domain.Task",
              "Identity": "8"
            },
            "Client": {
              "__type": "Replicon.Project.Domain.Client",
              "Identity": "2"
            }
          },
          {
            "__operation": "SetTaskRowBilling",
            "BillingType": {
              "__type": "Replicon.Project.Domain.Timesheets.TimesheetBillingType",
              "Identity": "DepartmentOverrideRate"
            },
            "BillingDepartment": {
              "__type": "Replicon.Domain.Department",
              "Identity": "2"
            },
            "Project": {
              "__type": "Replicon.Project.Domain.Project",
              "Identity": "1"
            }
          }
        ]
      }
    ]
  }
]

Add Timesheet TimeOff Row

Add a timesheet time off row that specifies a time off cell on an existing timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "74",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeOffRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "TimeOffCode": {
              "__type": "Replicon.TimeOff.Domain.TimeOffCode",
              "Identity": "1"
            }
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "Cells",
            "Operations": [
              {
                "__operation": "SetProperties",
                "EntryDate": {
                  "__type": "Date",
                  "Year": 2011,
                  "Month": 2,
                  "Day": 18
                },
                "Duration": {
                  "__type": "Timespan",
                  "Hours": 8
                },
                "Comments": "Remote API cell 1"
              }
            ]
          }
        ]
      }
    ]
  }
]

Edit a Timesheet (Standard, Activity-only Timesheet)

Edit a specific Standard (not In-out), activity-only (no tasks) timesheet; Clear out the timesheet, add a new timesheet row associated with activity #5, add two cells to the row, with 8 hours and 6 hours of time entered, and set a sheet-level, a row-level, and a cell-level user defined field.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "SetUdfValues",
        "Test Sheet UDF": "w00t 1"
      },
      {
        "__operation": "CollectionClear",
        "Collection": "TimeRows"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Activity": {
              "__type": "Replicon.Domain.Activity",
              "Identity": "5"
            }
          },
          {
            "__operation": "SetUdfValues",
            "Test Row UDF": "w00t 2"
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "Cells",
            "Operations": [
              {
                "__operation": "SetProperties",
                "CalculationModeObject": {
                  "__type": "Replicon.TimeSheet.Domain.CalculationModeObject",
                  "Identity": "CalculateInOutTime"
                }
              },
              {
                "__operation": "SetProperties",
                "EntryDate": {
                  "__type": "Date",
                  "Year": 2010,
                  "Month": 7,
                  "Day": 20
                },
                "Duration": {
                  "__type": "Timespan",
                  "Hours": 8
                },
                "Comments": "Remote API cell 1"
              },
              {
                "__operation": "SetUdfValues",
                "Test Cell UDF": "w00t 3"
              }
            ]
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "Cells",
            "Operations": [
              {
                "__operation": "SetProperties",
                "CalculationModeObject": {
                  "__type": "Replicon.TimeSheet.Domain.CalculationModeObject",
                  "Identity": "CalculateInOutTime"
                }
              },
              {
                "__operation": "SetProperties",
                "EntryDate": {
                  "__type": "Date",
                  "Year": 2010,
                  "Month": 7,
                  "Day": 21
                },
                "Duration": {
                  "__type": "Timespan",
                  "Hours": 6
                },
                "Comments": "Remote API cell 2"
              },
              {
                "__operation": "SetUdfValues",
                "Test Cell UDF": "w00t 3"
              }
            ]
          }
        ]
      }
    ]
  }
]

Edit a Timesheet (In-Out, Activity-only TS)

Edit a, In-out (not Standard), activity-only (no tasks) timesheet; Clear out the timesheet, add a new row and a new cell. In In-out timesheets, time is entered by specifying the time in and time out, rather than the duration. The in-time in this example is 8:00am, and the out-time is 10:30am.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "CollectionClear",
        "Collection": "TimeRows"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeRows",
        "Operations": [
          {
            "__operation": "CollectionAdd",
            "Collection": "Cells",
            "Operations": [
              {
                "__operation": "SetProperties",
                "CalculationModeObject": {
                  "__type": "Replicon.TimeSheet.Domain.CalculationModeObject",
                  "Identity": "CalculateDuration"
                }
              },
              {
                "__operation": "SetProperties",
                "EntryDate": {
                  "__type": "Date",
                  "Year": 2010,
                  "Month": 7,
                  "Day": 20
                },
                "TimeIn": {
                  "__type": "Time",
                  "Hour": 8,
                  "Minute": 0
                },
                "TimeOut": {
                  "__type": "Time",
                  "Hour": 10,
                  "Minute": 30
                }
              }
            ]
          }
        ]
      }
    ]
  }
]

Submit Timesheet

Submit a timesheet for approval. This operation can be done as part of an edit, but is shown here as a separate query.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Submit",
        "Comment": "My submit comment"
      }
    ]
  }
]

Unsubmit Timesheet

Unsubmit a timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Unsubmit"
      }
    ]
  }
]

Approve Timesheet

Approve a submitted timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Approve",
        "Comment": "I approve of this timesheet."
      }
    ]
  }
]

Reject Timesheet

Reject a submitted timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Reject",
        "Comment": "I don't like this timesheet."
      }
    ]
  }
]

Reopen Timesheet

Reopen a closed timesheet.

[
  {
    "Action": "Edit",
    "Type": "Replicon.TimeSheet.Domain.Timesheet",
    "Identity": "125",
    "Operations": [
      {
        "__operation": "Reopen",
        "Comment": "Gotta make a fix."
      }
    ]
  }
]

FilteredHistory relationship in Timesheet

Filtered Timesheet approval history is a subset of Timesheet approval history that does not contain the modifications performed by the timesheet owner or the substitute of timesheet owner at any time.

[
  {
    "Action": "Query",
    "QueryType": "EntryTimesheetByUser",
    "DomainType": "Replicon.Suite.Domain.EntryTimesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      }
    ],
    "Load": [
      {
        "Relationship": "FilteredHistory"
      }
    ]
  }
]

Query timesheets by modified since (UTC)

Query timesheets modified since a specific date/time (UTC timezone).

[
  {
    "Action": "Query",
    "QueryType": "TimesheetsModifiedSince",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "Type": "DateTime",
        "Year": 2011,
        "Month": 7,
        "Day": 19,
        "Hour": 10,
        "Minute": 12,
        "Second": 49
      }
    ]
  }
]

Query timesheets by user and modified since (UTC)

Query for timesheets owned by a specific user, and modified since a specific date & time (UTC timezone).

[
  {
    "Action": "Query",
    "QueryType": "TimesheetsByUserModifiedSince",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "Type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "Type": "DateTime",
        "Year": 2011,
        "Month": 7,
        "Day": 19,
        "Hour": 10,
        "Minute": 12,
        "Second": 49
      }
    ]
  }
]

Query timesheets by approver

Query for timesheets waiting for approval by a specific approver.

[
  {
    "Action": "Query",
    "QueryType": "TimesheetWaitingApprovalByApprover",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "Type": "Replicon.Domain.User",
        "Identity": "2"
      }
    ]
  }
]

Query timesheets by approver and modified since (UTC)

Query for timesheets waiting for approval by a specific approver, and modified since a specific date & time (UTC timezone).

[
  {
    "Action": "Query",
    "QueryType": "TimesheetWaitingApprovalByApproverModifiedSince",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "Type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "Type": "DateTime",
        "Year": 2012,
        "Month": 3,
        "Day": 2,
        "Hour": 17,
        "Minute": 40,
        "Second": 22
      }
    ]
  }
]