Check condition for inactive owner

  • Used Zammad version: 3.1.x
  • system: Windows 10
  • Chrome : Version 81.0.4044.138 (Official Build) (64-bit)

Expected behavior:

  • Ticket is assigned to a user ‘XYZ’. After a day ‘XYZ’ is made inactive, then I want the ticket to be reassigned to ‘ABC’.
    I thought if a person is made inactive,ticket assigned to that person will be assigned to ‘nil’ but its not happening.
    Is there a way to check the condition if owner is inactive then change the owner in scheduler or trigger.?

Actual behavior:

  • If user is inactive, tickets already assigned to him in open state doesn’t get reassigned to nil

Steps to reproduce the behavior:

  • Create a ticket and assign to a user
    Make that user inactive

Before answering your question, one very important thing:

For the sake of your and Zammads security, please upgrade to the latest Zammad version asap. You’re vunerable to at least 14 security issues you may want to solve.

Zammad doesn’t update old tickets owners upon deactivating owners because of performance reasons.
Technically, if you deactivate a user with let’s say 10.000 Tickets, you’d potentially temporary strike the systems performance, as such a task is quite expensive in I/O and time terms.

There’s no logic available in Zammad that does the trick for you.

so what can you do…?

If you require to ensure to reset the owner to “nobody”, you could do so on the rails console.
Theoretically this shouldn’t be a regular task (except if you change your agents alot).

To do so you can run:

Untested command ahead

zammad run rails r "p Ticket.where(owner_id: User.find_by(email: '{email@inactive.agent}).id).each{|ticket| ticket.update(owner_id: nil) }

Replace {email@inactive.agent} with the agents mail address.

Technically you could also do that magically task via API if you’d want to.
Please, again, keep in mind that this may strike performance greatly.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.