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
  • Hi Paul

    Kaseya 6.2 and SD 1.3.

    Ok. 

    I had already created three two datetime type and a string to get the value!

  • Paul,

    I did the following test on the "Change Procedure", enter the following commands:

    <?xml version="1.0" encoding="utf-8"?>
    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
    <Procedure name="Mudanca" treePres="15" id="48106846800062319792904803" folderId="51881614423121235561692251">
    <Body description="">
    <If isDisabled="false" description="">
    <Condition name="TestCustomField">
    <Parameter xsi:type="StringParameter" name="PropertyName" value="StartTime" />
    <Parameter xsi:type="ListParameter" name="Condition" value="Exists" />
    <Parameter xsi:type="StringParameter" name="Value" value="" />
    </Condition>
    <Then>
    <Statement isDisabled="false" description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommandEx" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="Command" value="echo %date%" />
    <Parameter xsi:type="BooleanParameter" name="WaitForCompletion" value="false" />
    <Parameter xsi:type="BooleanParameter" name="RedirectToLog" value="false" />
    <Parameter xsi:type="StringParameter" name="OutputFile" value="" />
    <Parameter xsi:type="StringParameter" name="OutputVariable" value="currentdate" />
    </Statement>
    <Statement isDisabled="false" description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommandEx" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="Command" value=" time /t" />
    <Parameter xsi:type="BooleanParameter" name="WaitForCompletion" value="false" />
    <Parameter xsi:type="BooleanParameter" name="RedirectToLog" value="false" />
    <Parameter xsi:type="StringParameter" name="OutputFile" value="" />
    <Parameter xsi:type="StringParameter" name="OutputVariable" value="currenttime" />
    </Statement>
    <Statement isDisabled="false" description="Assigns a value to a custom field of the ticket." name="AssignCustomProperty" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="PropertyName" value="EndTime" />
    <Parameter xsi:type="StringParameter" name="Value" value="[=currentdate=] [=currenttime=]" />
    </Statement>
    <Statement isDisabled="false" description="Create a named script variable and assign a value." name="GetVariable" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="VariableName" value="end" />
    <Parameter xsi:type="ListParameter" name="VariableType" value="ConstantValue" />
    <Parameter xsi:type="StringParameter" name="SourceContent" value="[$EndTime$]" />
    </Statement>
    <Statement isDisabled="false" description="Create a named script variable and assign a value." name="GetVariable" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="VariableName" value="start" />
    <Parameter xsi:type="ListParameter" name="VariableType" value="ConstantValue" />
    <Parameter xsi:type="StringParameter" name="SourceContent" value="[$StartTime$]" />
    </Statement>
    <Statement isDisabled="false" description="Execute a SQL command that returns data." name="ExecuteSqlQuery" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="Sql" value="select DATEDIFF (d, '[=start=]' , '[=end=]' )" />
    <Parameter xsi:type="StringParameter" name="VariableName" value="[=result=]" />
    </Statement>
    <Statement isDisabled="false" description="Assigns a value to a custom field of the ticket." name="AssignCustomProperty" continueOnFail="false" osType="">
    <Parameter xsi:type="StringParameter" name="PropertyName" value="Duracao" />
    <Parameter xsi:type="StringParameter" name="Value" value="[=result=]" />
    </Statement>
    </Then>
    </If>
    </Body>
    </Procedure>
    </ScriptExport>

    The error is happening that appears in the picture below.

  • Can you post examples of what the field value are

    I wonder if Echo %date%  output is in the wrong format for the datediff SQL command

    What version of SQL are you using

    If you google the error it sounds like a common issue

    social.msdn.microsoft.com/.../78d3989a-8975-4930-998d-1eb907966f57

    And do you have any other SQL commands that work ok

  • Paul,

    This was my first time using sql commands to get data in Kaseya! There is some stuff about how the Kaseya and SQL work together!

    That command to get the date returned with error, I found the% date% to get the date.

    when I do a datediff in sql, I use single quotes in the variables I noticed that the command that you do not you put me enivou, returning this error:

    Error processing procedure sbo_treePresNoteProcedures_List Mudanca

    Error processing Kaseya.Scripting.Statements.ThenToken

    Error executing SQL command 'select DATEDIFF (' d ', 12/05/2013 15:14:17, 17/05/2013 15:22:00)'

    Incorrect syntax near '15 '.

  • But doesn't Echo %Date% output the result as "Fri 17/05/2013"

    I'm pretty sure Datediff needs the date to be in the format as just "17/05/2013"  ie without the 'Fri" at the start