/build/static/layout/Breadcrumb_cap_w.png

Custom Ticket rule "Run Once"

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

Answers (2)

Posted by: chucksteel 9 years ago
Red Belt
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.

Comments:
  • Where does that get put into the ticket rule? - inds 9 years ago
    • 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. - chucksteel 9 years ago
Posted by: Paloma 9 years ago
Purple Belt
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


Comments:

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ