onTimeSheetCreate
When a time entry is added to a ticket, problem, change, or release, the onTimesheetCreate event is invoked and the registered callback method is executed.
Subscribe to the onTimesheetCreate event and register the callback by using the following sample manifest.json content.
"events": {
"onTimesheetCreate": {
"handler": "onTimesheetCreateCallback"
}
}
Define the corresponding callback by using the following sample server.js content:
exports = {
onTimesheetCreateCallback: function(payload) {
console.log("Logging arguments from onTimesheetCreate event: " + JSON.stringify(payload));
}
}
Attributes of the data object
- actorobject
Information pertaining to the system, agent, or requester who triggered the onTimesheetCreate event in the Freshservice system.
- taskobject
A task works as a checklist that can be delegated to other teams. For instance, if you receive a ticket requiring actions from another team before resolution, you can create a task, assign it to the appropriate agent, and set a due date. To learn more about tasks, see Tasks.
This attribute contains information pertaining to the task for whom the time entry is created. - timesheetobject
Information pertaining to the time entry in the Freshservice system.
onTimeSheetUpdate
When a time entry of a ticket, problem, change, or release, is updated, the onTimesheetUpdate event is invoked and the registered callback method is executed.
Subscribe to the onTimesheetUpdate event and register the callback by using the following sample manifest.json content.
"events": {
"onTimesheetUpdate": {
"handler": "onTimesheetUpdateCallback"
}
}
Define the corresponding callback by using the following sample server.js content:
exports = {
onTimesheetUpdateCallback: function(payload) {
console.log("Logging arguments from onTimesheetUpdate event: " + JSON.stringify(payload));
}
}
Attributes of the data object
- actorobject
Information pertaining to the system, agent, or requester who triggered the onTimesheetUpdate event in the Freshservice system.
- changesobject
Changes that triggered the onTimesheetUpdate event, specified as a JSON object of the following format:
"changes": { //For non-array attributes "<timesheet.attribute that changed>": ["Old value", "New value"] }
Note:If the billable attribute or any custom attribute with a boolean data type is changed from false to true, the changes array for this attribute will display the prior and updated values as ["none", true]
- taskobject
A task works as a checklist that can be delegated to other teams. For instance, if you receive a ticket requiring actions from another team before resolution, you can create a task, assign it to the appropriate agent, and set a due date. To learn more about tasks, see Tasks.
This attribute contains information pertaining to the task for whom the time entry is updated. - timesheetobject
Information pertaining to the time entry in the Freshservice system.