Does anyone know if there is a way to modify a custom ticket rule so that it only runs when a ticket is initially (first) saved, instead of every save?  We have a ticket rule that moves tickets to the correct category and default owner.  But if the owner needs to be changed, the ticket rule kicks off on save and undoes the change.  Is there any kind of "Run Once" stipulation that can be added to the rule?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

4
Join to the ticket change table:
JOIN HD_TICKET_CHANGE ON HD_TICKET_CHANGE.HD_TICKET_ID = HD_TICKET.ID 
 and HD_TICKET_CHANGE.ID=<CHANGE_ID>

Then add this to the where clause:
HD_TICKET_CHANGE.DESCRIPTION LIKE '%Ticket Created%'

This will only match on initial ticket changes.
Answered 12/02/2014 by: chucksteel
Red Belt

  • Where does that get put into the ticket rule?
    • In general MySQL statements follow an outline like this:

      SELECT columns
      FROM tables
      JOIN other tables
      WHERE statements are true

      So, the join statement above would follow the FROM statement in your rule and the other statement would be added to the WHERE statements that are probably in your rule already.

      If you aren't familiar enough with MySQL to add these yourself then you can post your current rule and someone can update it with the additions.
Please log in to comment

Answers

2
well, i dont know if it is the best solution, bus you can set a custom field (hide) as a counter, one of your where conditions has to be that this counter is 0 and in the update query increase this counter, so as once the rule set the first time, the counter is gonna be 1, so the rule is not gonna act on this ticket any more.
I used it in this rule:

In resume would be:

where HD_PRIORITY.ID = HD_PRIORITY_ID
and HD_STATUS.ID = HD_STATUS_ID
and HD_IMPACT.ID = HD_IMPACT_ID
and HD_CATEGORY.ID = HD_CATEGORY_ID
and HD_TICKET.CREATED = HD_TICKET.MODIFIED
and HD_TICKET.CUSTOM_FIELD_VALUE1 = 0 #Contador

->Update SQL

update HD_TICKET
set HD_TICKET.MODIFIED = NOW(),
HD_TICKET.CUSTOM_FIELD_VALUE1 = HD_TICKET.CUSTOM_FIELD_VALUE1 + 1

Answered 12/02/2014 by: Paloma
Purple Belt

  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment
Answer this question or Comment on this question for clarity

Share