Kaseya Community

How to add time to a Service Desk ticket from within a procedure?

  • Our admins do a lot of ticket generation by simply sending an email and letting Kaseya create the ticket. They are also using email mapping to update existing tickets. So is there a way to include a certain amount of time in the Incident Mapping script?

  • any updates on this?

  • Hello Shawn.

    What do you mean? Add "invoicable time" to a ticket?

  • Time in the Hours Worked field.

  • im sure it's possible but im also lost . do you mean in the time and tracking module. Can you post a screen shot ?

  • Instead of forcing the admins to open up the ticket and manually enter in time after sending a reply:



    Here is an email reply and you can see it doesn’t add any time:



    Our company only uses Kaseya internally so we don’t invoice our time. We use time as a metric for reporting.


  • Update Ticket Time.xml

    Right so i have spent alot of time on this but here you go.

    Put the provided XML here 


    Then pass it

    Ttime = time in hours  

    TNum = ticket number

    It will update the last note that is NOT hidden with the time you pass it.

    This therefore assumes that the note you want to add time to has already been added to the ticket

    <?xml version="1.0" encoding="utf-8" ?>
    <queryDef label="Update Ticket Time" sql="update top (1) ksubscribers.kasadmin.sdIncidentActivityHours set sdhoursworked = '[=Ttime=]' from kasadmin.SDIncidentActivity WITH (NOLOCK) INNER JOIN kasadmin.SDIncident WITH (NOLOCK) ON kasadmin.SDIncidentActivity.sdIncidentFK = kasadmin.SDIncident.id INNER JOIN kasadmin.sdIncidentActivityHours ON kasadmin.SDIncidentActivity.id = kasadmin.sdIncidentActivityHours.sdIncidentActivityFK WHERE (kasadmin.SDIncident.ref = '[=TNum=]' and hiddenFlag = 'N')"/>


  • Hi Michael,

    This is a good query, but there there is no guarantee that you will get the correct record.  The Select top 1 will not guarantee you are updating the correct note, since ms sql will return the top 1 based on what it thinks is best optimized.   I have been discussing with my team on implementing a noteTime field for the input of the addNote function in the SD procedures and will keep this thread posted when we are able to address this.

    I will work next week with my team to allow adding time to a note in addNote.  
    On second thought it is important to do it this way since when a note is first added the time gets sent to Time Tracking.  
    Updating the database will not send the update to Time Tracking (since this i done in code), , if it were changed it would cause auditing issues.



    [edited by: Charles at 10:19 PM (GMT -7) on Mar 27, 2013] The time needs to be added when the note is added or auditing issues could occur.
  • ok will change on Tuesday once im back from holiday

  • Hi All,

    I wanted to update this thread to let you know our QA just passed the hotfix which adds a new method to our procedures addNoteWithTime().

    We have to require a default user to assign the time to, so that our Time Tracking module can handle the request.  If you have no certain user you need the time applied to, then you can make a bucket user to assign the note time to.  The default user in the new method will not change the user the note is entered by, due to the fact this user carries permissions with the ticket which would break other procedures if it were changed.  The default user is only for assigning the note time.

    Here is an excerpt from our help:


    Adds a note and time to the ticket being processed by the procedure. Additional parameters include:

    Selecting a note template instead of entering a note.

    Making the note hidden or not.

    The time in minutes added with the note.

    Marking time added as billable or not.

    Selecting a Default User to associate the time entry with.

    Overriding the Default User with the user manually editing the ticket.

    Note: Overriding the Default User is unavailable for Goal, Escalation, Ticket Request De-Dup, or Ticket Request Mapping, since no user is manually editing the ticket just before these procedures are run.

    Note text can include an property variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Ticket Properties and Variables for a list of property variables. See Procedure Variables and Working with Variables for more information about variables.



  • That is just what the Dr. ordered!