Configure onTimeSheetCreate and onTimeSheetUpdate

onTimeSheetCreateFreshserviceFreshservice for MSPs

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.

manifest.json
"events": {
  "onTimesheetCreate": {
      "handler": "onTimesheetCreateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
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.

    • profile_idinteger

      Identifier of the actor who triggered the product event.

  • 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.

    • idinteger

      Identifier of the task object.

  • timesheetobject

    Information pertaining to the time entry in the Freshservice system.

    • agent_idinteger

      Identifier of the agent to whom the time entry is currently assigned.

    • billableboolean

      Specifies whether the time entry is billable.

      Possible values: true, false

    • created_atstring

      Timestamp indicating when the time entry was created, specified in the ISO-8601 format.

    • custom_fieldsobject

      To obtain additional time entry information, custom fields could be configured in the Freshworks system.


      The custom_fields attribute contains the custom field names and corresponding values, as a valid JSON object of key (custom field name)-value (custom field’s value) pairs.


      For more information about custom fields in time entries, see Adding custom fields for time entries.

    • executed_atstring

      Timestamp indicating the actual start time entered by the agent in the Add time section, specified in the ISO-8601 format.


      If the agent edits or updates the start time, the executed_at value will be updated to match this new start time, making it a dynamic field that captures any changes the agent makes.

    • idinteger

      Identifier of the time entry object, auto-generated when a time entry is created in the Freshservice system.

    • notestring

      Content added to the Note section of the time entry.

    • note_truncatedboolean

      Specifies whether the content added to the note section of the time entry has been truncated.

      Possible values: true, false

    • start_timestring

      Timestamp of when the timer for the time entry was initially started, specified in ISO-8601 format.

    • time_spentinteger

      Duration of the timer set for the time entry, specified in seconds.

    • timer_runningboolean

      Specifies whether the timer is currently running for the time entry.

      Possible values: true, false

    • updated_atstring

      Timestamp of when the details for the time entry was updated, specified in ISO-8601 format.

      For onTimesheetCreate, this attribute value is the same as the created_at value.

    • workable_typestring

      This attribute represents the entity for which the time entry is created. If a time entry is created for a task, the parent entity of that task is considered as workable.

    • workspace_idinteger

      Important:When the onTimesheetCreate event is triggered in accounts without workspaces, this attribute is not returned in the payload.

      In Freshservice for MSPs product accounts, workspace_id is the identifier of the client associated with the tickets/problem/change/release.


      In Freshservice product accounts with workspaces, tickets/problem/change/release, belong to specific workspaces. A workspace is a configurable, team or department-specific space where team-members can collaborate while maintaining the operational integrity of team-only data. workspace_id is the identifier of the workspace where the tickets/problem/change/release is created. It is auto-generated when a new workspace is created in Freshservice. For information about workspaces, read What is a workspace. To retrieve all the workspaces that are created in an account, through APIs, use the List all workspaces API

      Note for Freshservice product account:workspace_id is displayed as part of the account URL when you (or the app user) navigate to the admin settings of the workspace. For example, when you navigate to the primary workspace’s admin settings, if the corresponding URL is /ws/2/admin/home, the workspace’s ID is 2.

    • workableobject

      Information pertaining to the workable (parent entity) where the time sheet is created.

      • idinteger

        Identifier of the object.

onTimeSheetUpdateFreshserviceFreshservice for MSPs

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.

manifest.json
"events": {
  "onTimesheetUpdate": {
      "handler": "onTimesheetUpdateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
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.

    • profile_idinteger

      Identifier of the actor who triggered the product event.

  • 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.

    • idinteger

      Identifier of the task object.

  • timesheetobject

    Information pertaining to the time entry in the Freshservice system.

    • agent_idinteger

      Identifier of the agent to whom the time entry is currently assigned.

    • billableboolean

      Specifies whether the time entry is billable.

      Possible values: true, false

    • created_atstring

      Timestamp indicating when the time entry was created, specified in the ISO-8601 format.

    • custom_fieldsobject

      To obtain additional time entry information, custom fields could be configured in the Freshworks system.


      The custom_fields attribute contains the custom field names and corresponding values, as a valid JSON object of key (custom field name)-value (custom field’s value) pairs.


      For more information about custom fields in time entries, see Adding custom fields for time entries.

    • executed_atstring

      Timestamp indicating the actual start time entered by the agent in the Add time section, specified in the ISO-8601 format.


      If the agent edits or updates the start time, the executed_at value will be updated to match this new start time, making it a dynamic field that captures any changes the agent makes.

    • idinteger

      Identifier of the time entry object, auto-generated when a time entry is created in the Freshservice system.

    • notestring

      Content added to the Note section of the time entry.

    • note_truncatedboolean

      Specifies whether the content added to the note section of the time entry has been truncated.

      Possible values: true, false

    • start_timestring

      Timestamp of when the timer for the time entry was initially started, specified in ISO-8601 format.

    • time_spentinteger

      Duration of the timer set for the time entry, specified in seconds.

    • timer_runningboolean

      Specifies whether the timer is currently running for the time entry.

      Possible values: true, false

    • updated_atstring

      Timestamp of when the details for the time entry was updated, specified in ISO-8601 format.

    • workable_typestring

      This attribute represents the entity for which the time entry is created. If a time entry is created for a task, the parent entity of that task is considered as workable.

    • workspace_idinteger

      Important:When the onTimesheetCreate event is triggered in accounts without workspaces, this attribute is not returned in the payload.

      In Freshservice for MSPs product account, workspace_id is the identifier of the client associated with the tickets/problem/change/release.


      In Freshservice product accounts with workspaces, tickets/problem/change/release, belong to specific workspaces. A workspace is a configurable, team or department-specific space where team-members can collaborate while maintaining the operational integrity of team-only data. workspace_id is the identifier of the workspace where the tickets/problem/change/release is updated. It is auto-generated when a new workspace is created in Freshservice. For information about workspaces, read What is a workspace. To retrieve all the workspaces that are created in an account, through APIs, use the List all workspaces API.

      Note for Freshservice product account:workspace_id is displayed as part of the account URL when you (or the app user) navigate to the admin settings of the workspace. For example, when you navigate to the primary workspace’s admin settings, if the corresponding URL is /ws/2/admin/home, the workspace’s ID is 2.

    • workableobject

      Information pertaining to the workable (parent entity) where the time sheet is updated.

      • idinteger

        Identifier of the object.