Kaseya Community

time a ticket was on a stage

This question is not answered
Hello Community!

Assumed implementation of SD Kaseya and need know if it is possible to know the time a ticket was on a stage?
All Replies
  • Hmm .. the notes field tells you the date/time when a ticket change occurred .. and this includes stage changes.

    But it would be quite messy to filter out the date/time in amongst all the other data

    So 2 ideas

    1) You could add an escalation procedure for each stage that runs a command every 5 mins as an example

    So the command would run the first time , and set the variable to 5

    Then it would run again 5 minutes later and then increment the variable to 10

    etc until the ticket leaves the stage

    You'd need a separate variable for each stage

    Would you ever have a ticket leaving a stage and then later return to the same stage ?

    2) There’s also a Kaseya Databse view “vbo_SDIncidents_Activities”  that is a sort of history re ticket changes

    If you filter the SDNote filed you can find all the entries that relate to










     FROM [ksubscribers].[kasadmin].[vbo_SDIncidents_Activities]

     where SDNOTE like '%stage%was%'

  • The longer you sit and think the more ideas come to mind

    Why not just create 2 custom fields for each Stage .. and then in the stage entry procedure write the date/time to one , and the Stage Exit procedure write the date/time to the other.

    Then you can build reports etc that can show the duration by calculating the date/time difference between the 2 fields

  • Great idea, Paul!

    I really enjoyed this second idea! Creating these two fields, type DATE / TIME, use some procedure that can tell me the difference or will I have to do it through the database?

    Thank you for helping me be!


  • Hi Clairo,

    Are you able to achieve the above requirement. If so then let me know the steps or attach the procedure which contains the steps of capturing date/time and computing the data for the reports.

    This method can be used to get the response SLA of the Ticket.


  • I've just finished working out how to run vbscript from within an SD Procedure

    So if I get a chance tomorrow I'll see if I can create one that takes the start and end date/times and works out the difference and then writes the difference to a 3rd Custom Field.

    So once it is computed and available in the custom field you can run reports etc from it.

    So just a matter of do I store the calculated result value as minutes or days . I vote for minutes



  • Jay,

    My English is not the best! I do not understand what you want to know. If you could redesign for my better understanding ...

    Thanks for helping me,



  • Paul..

    Thanks for helping me!

    Very good to have support with this!

  • ShellCommands.zip

    Heres a zip file with an example of the shell commands to run and the Stage Entry/Exit steps.

    I'm still working on getting the vb part to work , but as is it will add the date-time to your custom fields.

    You will need to ensure the field names match the ones you've used , so you'll need to rename parts of the code

    The bit missing is to add the Time Difference between start and end when the ticket leaves the stage

  • Hi Paul,

    Thanks for posting the procedures. Today i will test and let you know by tomorrow..


  • Hi Paul,

    Follows the print in red being collected from vbs.

    I do not have the habit of working with vbs, but I read some articles on the net! I tested the script informing the data and it worked! Could tell me walk'm missing?


  • The vb script need to be changed :


    cscript.exe c:\kworking1\sdtime.vbs [=starttime=] [=endtime=]


    cscript.exe c:\kworking1\sdtime.vbs //NoLogo [=starttime=] [=endtime=]

    This will suppress the Logo and return just the result

  • There always more than one way to do these

    you could just use 3 new SQL command

    Stage Entry use  : select getDATE() as Starttime

    Stage Exit use     : select getDATE() as Endtime

                                  : select DATEDIFF(MINUTE,[=starttime=],[=endtime=])

  • Hi Paul,

    Thats great. I think using the SQL method will be good as we don't have to depend on the vbscript but knowing both type of methods is always great.

    Is there any way to achieve the same in saas server.  I am not sure whether the Kaseya Team will allow adding the SQL or Shell commands in the system.



  • Paul,

    Good morning,

    Yesterday I tried several possible ways those scripts in vbs that you sent, but it does not insert variables into the script myself returning to output 0.

    I created a vbs that received the data and write to a text file, but the file was always empty! My knowledge in Kaseya and development is very limited as it is not my area of expertise!

    Regarding these sql commands I sent it returns this error:

    Error processing procedure sbo_treePresFieldMapProcedures_List Final Test

    Error executing SQL command 'select DATEDIFF (mi, StartTime, EndTime)'

    Invalid column name 'StartTime'. Invalid column name 'EndTime'.

    I am look forward to your already gardeço much for your attention!

  • What version of Kaseya and SD are you using

    Kaseya 6.3 and SD 1.4

    or Kaseya 6.2 and SD 1.3 ?

    The Datediff command needs to look like something like this :

    select DATEDIFF (minute, [=StartTime=], [=EndTime=])'

    ie , when you use the Start and End times they must be entered as variables which you have previously got from earlier steps