Can a ticket rule be used to add work time?
We have a tasks that have a consistent work time of 15 min that I would like create a rule that adds 15 min on save.
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
chucksteel
12 years ago
It should be possible. How will the technicians indicate that they performed a task that meets the criteria?
Comments:
-
I will be keying off the ticket title. These specific tasks are generated from monitoring software, so we have full control over the title structure. - Trusner 12 years ago
-
I did some checking and you would need to run an INSERT statement into the HD_WORK table. The statement would look something like this:
INSERT INTO HD_WORK (HD_TICKET_ID, USER_ID, NOTE, START, STOP, ADJUSTMENT_HOURS)
VALUES (
<TICKET_IDS>,
[hard code a user id here],
&amp;quot;Work added by rule&amp;quot;,
NOW(),
NOW(),
0.15)
I haven't tested this but I believe it would do the job. I have the [hard code user id here] because it seems it would be the best way to signify that the work was added via a rule. I would probably create a bogus user in KACE and use that userid. Note that this also sets the start and end times for the work to the same value.
You also need to be careful that the select statement will return only one ticket so that the TICKET_IDS variable only contains one ticket ID. If the rule is set to run on save this shouldn't be an issue. You should also have your select statement query the HD_WORK table to make sure the work hasn't already need added for this ticket, otherwise every time the rule runs it will add the work time again.
I have never tried placing in INSERT statement where the UPDATE statement normally goes but as far as I know this is possible.
If you give this a shot and have trouble please post your code so we can help figure it out further. - chucksteel 12 years ago